Replies: 3 comments
-
@m10 The webpack-dev-server already uses webpack-dev-middleware under the hood.
To enable hot reloading add following configuration: devServer: {
static: {
directory: path.join(__dirname, 'public'),
hot: true, // defaults is true
},
// add this for watching your files
watchFiles: {
paths: ['src/**/*.*'],
options: {
usePolling: true,
},
},
}, This is enough in all cases. You can try the Hello World in dev modus:
Change any source file and the browser will be hot reloaded. |
Beta Was this translation helpful? Give feedback.
-
Yes, I read about it. Our setup involves using We would like to implement the equivalent with I am unusre how this could be solved. |
Beta Was this translation helpful? Give feedback.
-
I understand the problem: Currently, I must self restart the webpack after add/remove a new template as entry-point in webpack config. But for me it's no problem, I do it not each 5 minutes. I don't know the solution to this problem. I'm sorry. P.S.: The pug plugin is designed to properly development with Pug, where the entry point is the Pug template, and all dependent scripts and styles will be used in the right place - in the Pug template. But the For more control of a middleware you can try to use the devServer.setupMiddlewares option. To write the compiled assets to disk can be used the option: devServer: {
static: {
directory: path.join(__dirname, 'public'),
hot: true, // defaults is true
},
{
devMiddleware: {
writeToDisk: true
}
}
} |
Beta Was this translation helpful? Give feedback.
-
We use
webpack-hot-middleware
[1] in Development for hot reloading.Our entrypoints currently look like this:
Development:
Production:
In development (only) each entrypoint needs to have 'webpack-hot-middleware/client?reload=true'.
How can we configure this with
pug-plugin
?[1] https://github.com/webpack-contrib/webpack-hot-middleware
Beta Was this translation helpful? Give feedback.
All reactions