简体   繁体   English

当我在package.json中更改了一个必需的模块时,如何重新加载webpack?

[英]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.

相关问题 在Webpack中更改所需模块之一后,如何重新加载页面? - How can I reload the page when I changed one of my required modules in Webpack? 破坏 node_modules 和 package.json 后如何重置依赖树? - How can I reset my dependency tree after ruining node_modules and package.json? 当新安装的模块没有出现在 package.json “依赖项”列表中时,如何在 React 中使用它们? - How do I use newly installed modules in React when they do not appear in the package.json "dependencies" list? 如何将所有已安装的节点模块保存在package.json中? - How can I save all the installed node modules in package.json? 如何将 eslint airbnb 风格指南合并成一个文件以复制到 package.json 中? - How can I concatinate the eslint airbnb style guide into one file to copy into package.json? 如何告诉Prettier忽略package.json文件? - How can I tell Prettier to ignore a package.json file? 如何使用流星添加更新package.json? - How can I update the package.json using meteor add? 如何从 package.json 配置 uglifyjs - How can I configure uglifyjs from package.json 如何将推荐的ESLint传递给package.json? - How can I pass ESLint recommended to package.json? 如何在package.json中的脚本中添加时间戳? - How can I add a timestamp into a script in package.json?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM