Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 218 Vote(s) - 3.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
webpack-dev-server hot reload not working

#11
You can try adding this to your config:

```js
module.exports = {
...
devServer: {
contentBase: './dist/', // Since your index.html is in the "dist" dir
open: true, // Automatically open the browser
hot: true, // Automatically refresh the page whenever bundle.js changes
// (You will have to refresh manually if other files change)
},
...
};
```

And then running (no options):
`webpack-dev-server`
Reply

#12
With the above settings, while using `webpack-dev-server` for static page building I add bundle js or whatever js file configured as output to the html page. This way I get refresh on my static page after any changes.
Reply

#13
The only thing that works for me is apply the "[hotOnly][1]" inside the configuration of the "devServer" (on the "webpack.config.js"), like this:

devServer: {
hotOnly: true,
},

After reload the "Webpack Dev Server", the "Hot Reload" works, at least, after saving any change in CSS or JS files.


[1]:

[To see links please register here]

Reply

#14
All those who suffer: don’t forget slash before public path:
`publicPath:’/assets/scripts/‘` not `publicPath:’assets/scripts/’`
Three days lost because of 1 forward slash in the path string
Reply

#15
**For Webpack ^5.72.1**

This worked for me,

```
devServer: {
port: 3000,
hot: false,
liveReload: true,
},
```
Note: liveReload will reload the whole application on file save but it will lose application state. Hot reloading preserves state. But liveReload seemed to fix the issue for me with css/html not loading on the browser after save, without having to refresh the browser.
Reply

#16
For webpack version 5, the module.loaders is now module.rules. And for the presets change query to options.
Reply

#17
Make sure in development mode you are not using a plugin that extract css into files, example MiniCssExtractPlugin. It messes the things up.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through