I'm getting messages like [HMR] Waiting for update signal from WDS...
and [WDS] Hot Module Replacement enabled.
twice in Dev Tools console. Why is that? Am I doing something wrong?
My webpack.config.js
file:
... module.exports = () => { return { entry: { bundle: './src/app/App.jsx', sw: './src/app/sw.js' }, output: { filename: '[name].js', path: path.resolve(__dirname, 'dist'), globalObject: 'this' }, devtool: 'source-map', devServer: { contentBase: path.resolve(__dirname, 'dist'), historyApiFallback: true }, ... node: { fs: 'empty', net: 'empty', tls: 'empty' } }; };
Versions: "webpack": "^4.27.1"
, "react-hot-loader": "^4.6.0"
, "webpack-dev-server": "^3.1.10"
Hot Module Replacement (or HMR) is one of the most useful features offered by webpack. It allows all kinds of modules to be updated at runtime without the need for a full refresh. This page focuses on implementation while the concepts page gives more details on how it works and why it's useful.
Enables Hot Module Replacement, otherwise known as HMR.
Webpack provides support for caching the build files generated to improve the build speed. We can achieve this by providing a cache option set to true in the webpack. config. js file.
In production mode, Webpack does everything to use the bundle for production. It includes minification of the bundle file and other optimizations. Default value of mode is production .
I resolved this by removing the the auto injection line in public/index.html:
<div id="app"></div> <!-- built files will be auto injected --> <!-- <script type="text/javascript" src="/js/chunk-vendors.js"></script><script type="text/javascript" src="/js/app.js"></script> -->
Previously I was building vue site and using a nodejs express server to serve it statically. When I changed to using 'vue-cli-service serve' exclusivly I encountered this issue.
I hope this information is helpful to someone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With