I am using https://github.com/wbkd/webpack-starter that works great.
I want server to restart when I am changing the json
file that I placed in to src
folder. How would you do that?
This particular json
file I am using only in build time - no need that file when my content running in the browser.
If I change my josn file browser does not restarts, but even if I restart it manually I can not see my changes, only if I stop and start server changes appeared in browser. My json file contains some strings that I am replacing in my html during webpack build <%= config.title %>
.
Here is the webpack config files https://github.com/wbkd/webpack-starter/tree/master/webpack
I was trying to set watch: true
but didn't help.
Also I modify this line https://github.com/wbkd/webpack-starter/blob/master/webpack/webpack.config.dev.js#L12 to that:
devServer: {
inline: true,
contentBase: [Path.resolve(__dirname, '../src/myconfig.json'],
watchContentBase: true
},
but have no difference
Currently I solved my problem using nodemon:
"start": "nodemon --watch content/myconfig.json 'webpack-dev-server --open --config webpack/webpack.config.dev.js'"
However I have another problem, after server restated I have always new tab opened but it would be nice if just current tab gets reloaded, not sure if it is possible .
If you know better solution let me know.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.