Eschon
Eschon

Reputation: 538

webpack-dev-server does not update served bundle

Here's my webpack configuration:

module.exports = {
  entry: './src/index.js',
  output: {
    path: './js',
    filename: 'bundle.js'
  },
  module: {
    loaders: [
      {
        test: /\.jsx?$/,
        exclude: /node_modules/,
        loader: 'babel',
      }
    ]
  },
}

I start the webpack-dev-server like this: webpack-dev-server --inline from the root directory of my app.

The problem is when I make changes in my index.js file it looks like the dev-server is bundling in the console, but I see no changes in the browser. Even after manually refreshing the served bundle.js does not change (I'm looking at it in the developer tools, I know that webpack-dev-server serves the file from memory and doesn't write changes to the file system).

Is there anything wrong in my webpack configuration or do I need to configure the webpack-dev-server somehow?

Upvotes: 2

Views: 4228

Answers (1)

Eschon
Eschon

Reputation: 538

As Bob Sponge mentioned in the comments the problem is that the output.publicPath is missing. I've updated my config like this:

module.exports = {
  entry: './src/index.js',
  output: {
    path: './js',
    filename: 'bundle.js',
    publicPath: 'js/'
  },
  module: {
    loaders: [
      {
        test: /\.jsx?$/,
        exclude: /node_modules/,
        loader: 'babel',
      }
    ]
  },
}

Upvotes: 2

Related Questions