Epsilon47
Epsilon47

Reputation: 838

bundle.js not being rendered / 404 bundle.js not found

I have started a new react project, I have just some settings and files. My webpack.config.js looks like this:

module.exports = {
  entry: ['./src/index.js'],
  output: {
    path: __dirname,
    publicPath: '/',
    filename: 'bundle.js'
  },
  module: {
    loaders: [
      {
        exclude: /node_modules/,
        loader: 'babel',
        query: {
          presets: ['react', 'es2015', 'stage-1']
        }
      }
    ]
  },
  resolve: {
    extensions: ['', '.js', '.jsx']
  },
  devServer: {
    historyApiFallback: true,
    contentBase: './',
    watchOptions: {
      aggregateTimeout: 300,
      poll: 1000,
      port : 3000
    }
  }
};

When I run node ./node_modules/webpack-dev-server/bin/webpack-dev-server.js in cli. I get some files that have been processed. There is also a file bundle.js in the output:

bundle.js 917 kB 0 [emitted] main chunk {0} bundle.js (main) 890 kB [rendered] and there are several files as well, in the end of the output is:

webpack: Compiled successfully.

However, I do not see a bundle.js file in my files and the browser throws me:

GET http://letsreact.test/bundle.js 404 (Not Found)

I have been trying to solve it - there were answers that it might be rendered in memory, I am not sure - I'm new to react.

I am using valet, but it should not matter. I saw the similar questions but none of the answers did not really match my problem. I am using webpack 4.8.3

Upvotes: 1

Views: 2014

Answers (1)

mminar
mminar

Reputation: 130

Try not to open html file directly (via valet), but find url in the cli output - something like http://localhost:8080

Upvotes: 1

Related Questions