Reputation: 13801
I'm new to webpack and I'm using webpack dev server for HOT reload.My config looks like this:
new WebpackDevServer(webpack(config), {
publicPath: "./public/dist/bundle.js",
hot: true,
historyApiFallback: true,
proxy: {
'*': {
target: 'http://localhost:3000',
secure: false
}
}
}).listen(8080, 'localhost', function (err, result) {
if (err) {
return console.log(err);
}
console.log('Listening at http://localhost:8080/');
});
and when I start the webpack dev server, I expect it to bundle the js at ./public/dist/bundle.js
as specified. But it doesn't do. However it prints like as if it have done the bundle processing:
Version: webpack 1.13.1
Time: 93044ms
Asset Size Chunks Chunk Names
./public/dist/bundle.js 999 kB 0 [emitted] main
But in my file system bundle.js
is not present.
I could able to make it work by running webpack
first and then calling webpack dev server, which is working as expected!
Where I'm making mistake?
Upvotes: 3
Views: 3100
Reputation: 1764
It is in-memory, but you can set it to also write the bundles (WebPack v4) with:
"writeToDisk: true
Upvotes: 3
Reputation: 26873
Note that webpack-dev-server runs in-memory so it won't generate any files you should see by definition. If you want actual files, you should use webpack --watch
. You can run webpack --watch
and webpack-dev-server in parallel if you want to get both files and HMR.
Upvotes: 6