[英]Laravel Mix 'watch' not compiling when webpack.mix.js updated
When I run npm run watch
and update my source .js
and .scss
assets, the compilation is run automatically as expected.当我运行
npm run watch
并更新我的源.js
和.scss
资产时,编译会按预期自动运行。 When I update the webpack.mix.js
file, the changes are NOT compiled automatically.当我更新
webpack.mix.js
文件时,更改不会自动编译。
Is this something that v6 doesn't support?这是v6不支持的东西吗? Because v5 did work as expected.
因为 v5 确实按预期工作。
The config:配置:
const mix = require('laravel-mix')
mix.js('resources/js/app.js', 'public/js')
.sass('resources/css/app.scss', 'public/css')
.version()
package.json
: package.json
:
{
...
"scripts": {
"development": "mix",
"watch": "mix watch",
"watch-poll": "mix watch -- --watch-options-poll=1000",
"hot": "mix watch --hot",
"production": "mix --production"
}
...
}
Weird, it works for me.奇怪,它对我有用。 Have you tried
npm run watch-poll
instead?您是否尝试过
npm run watch-poll
? Are you running the latest version of Laravel Mix?您运行的是最新版本的 Laravel Mix 吗?
"laravel-mix": "^6.0.11",
Unrelated, you may want to update your package.json to the following if you're using Laravel Mix 6.无关,如果您使用 Laravel Mix 6,您可能需要将 package.json 更新为以下内容。
"scripts": {
"dev": "npm run development",
"development": "mix",
"watch": "mix watch",
"watch-poll": "mix watch -- --watch-options-poll=1000",
"hot": "mix watch --hot",
"prod": "npm run production",
"production": "mix --production"
},
According to 8.x Laravel Docs...根据 8.x Laravel 文档...
Webpack may not be able to detect your file changes in certain local development environments.
Webpack 在某些本地开发环境中可能无法检测到您的文件更改。 If this is the case on your system, consider using the watch-poll command.
如果您的系统出现这种情况,请考虑使用 watch-poll 命令。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.