Thursday, 1 June 2017

nodejs and webpack. http returns 404 not found for webpack's output js bundle

I have set up a nodejs app server with webpack in the c9.io cloud. check it out over here: https://ide.c9.io/yahretzkee/phaser

Launch it by running /src/server.js

Unfortunately the output bundle is not accesible by the client. Try to open preview in another tab and see what's going on.

Webpack's configuration is:

module: {
  rules: [
    {
      test: /\.js$/,
      exclude: /(node_modules|bower_components)/,
      use: {
        loader: 'babel-loader',
        options: {
          presets: ['env']
        }
      }
    }
  ]
},
entry: __dirname + "/js/game.js",
output: {
    path: path.join(__dirname, '/dist'),
    filename: "index_bundle.js"
},
plugins: [new HtmlWebpackPlugin()]

As you can see it is using HtmlWebpackPlugin to generate index.html including bundled output.

But in the console:

Failed to load resource: the server responded with a status of 404 (Not Found) (index_bundle.js)



via Piotr Chabros

No comments:

Post a Comment