Description
I'm submitting a bug report
webpack and webpack-dev-server version:
webpack: 2 beta 25
webpack-dev-server: 2 beta 8
Please tell us about your environment:
macOS Sierra
Running via NPM script (AKA CLI)
Current behavior:
Loading a path (that is not root) directly (say localhost:8080/about
) or refreshing it, will render the index.html
as expected but the html webpack plugin will never inject the script tags with the bundle.
Expected/desired behavior:
Loading the localhost:8080/about
should render the index.html
and have all the scripts injected into it.
- If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem along with a gist/jsbin of your webpack configuration. Be sure to specify how you are running the server.
If you want to reproduce it, clone this starter, install the dependencies, run npm start
, go to /about and refresh it.
- What is the expected behavior?
It should render the about page and not the index.html with the Loading... part.
I was unsure whether this is a bug at dev-server or html webpack plugin, but since the plugin is able to inject the stuff in the root path (or after a bundle) I think the bug relies on the dev server.
If you check the devServer config, you can see:
config.devServer = {
contentBase: './src/public',
historyApiFallback: true,
quiet: true,
stats: 'minimal' // none (or false), errors-only, minimal, normal (or true) and verbose
};
If I remove the contentBase
(and move the index.html) it works.
I am using the contentBase
to serve also the assets, so all the images can be loaded directly from there.
I could potentially remove the contentBase
and fix things around but this is definitely a bug.