[英]How can I reload the webpack when I changed one of my required modules in package.json?
It is okey when I changed the .js files in the same directory. 当我在同一目录中更改.js文件时,它很好。
But I have dependencies in package.json. 但我在package.json中有依赖项。 I didn't figure it out, is it possible the reload when I changed something in .js files one of these dependencies.
我没弄清楚,当我在.js文件中更改某些依赖项中的某些内容时,是否可能重新加载。
Update: 更新:
you can use this npm
command from package.json, 你可以使用package.json中的这个
npm
命令,
{
"build": "webpack --progress --color",
"watch": "nodemon --watch ./ --delay 200ms --exec npm run build"
}
You can use nodemon to watch files which are out of webpack context. 您可以使用nodemon来监视webpack上下文中的文件。 But webpack
watch
wont work with this. 但是webpack
watch
不会用这个。
nodemon --watch ./ --delay 200ms --exec 'your cmd here'
The above command will watch the files under the root folder and will execute the command which will trigger the webpack build. 上面的命令将监视根文件夹下的文件,并将执行将触发webpack构建的命令。 Here no need of setting
watch
flag for webpack because nodemon
is watching everything. 这里不需要为webpack设置
watch
标志,因为nodemon
正在监视所有内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.