My file structure is:
dist
css
style.css
index.html
js
bundle.js
src
css
style.css
index.html
js
main.js
node_modules
webpack.con
100% Working Solution
You have to just follow 3 steps and you will get your hot reloading as you expected
Your config should look like this -
output: { path: __dirname, publicPath:"/dist/js/", filename: './dist/js/bundle.js' }
devServer:{ contentBase:"/src/", inline:true, stats:"errors-only" }
Please note that contentBase should point to the path where you put your index.html file which contain your script tag in your case it will be "/src/"
in your case it will look like this -
And finally remember webpack-dev-server doesn't compile your js file or make build or watch on your js file it dose everything in memory to watch on your js file you have to run
webpack --watch
in seprate window