如何在对 webpack.config.js 进行更改后重新启动 Encore
How to restart Encore after making changes to webpack.config.js
我将 Symfony 与 Encore 一起使用,在阅读 this 文章后,它说在进行更改后重新启动 encore,但我找不到这样做的命令。我尝试设置 nodemon 来监视 webpack.config.js,但它抛出一个错误
yarn run v1.9.4
$ nodemon --watch webpack.config.js ./node_modules/.bin/webpack-dev-server
[33m[nodemon] 1.18.3[39m
[33m[nodemon] to restart at any time, enter `rs`[39m
[33m[nodemon] watching: webpack.config.js[39m
[32m[nodemon] starting `node ./node_modules/.bin/webpack-dev-server`[39m
[31m[nodemon] app crashed - waiting for file changes before starting...[39m
和
throw new Error(`Encore.${prop}() cannot be called yet because the runtime environment doesn't appear to be configured. Make sure you're using the encore executable or call Encore.configureRuntimeEnvironment() first if you're purposely not calling Encore directly.`);
我觉得我缺少一个简单的命令,但我似乎找不到它。这就是我在 package.json
中使用的
"start": "nodemon --watch webpack.config.js ./node_modules/.bin/webpack-dev-server",
如果你让 watcher 监视你的文件,你只需终止该进程,然后再次 运行 watch 命令:
yarn encore dev --watch
我将 Symfony 与 Encore 一起使用,在阅读 this 文章后,它说在进行更改后重新启动 encore,但我找不到这样做的命令。我尝试设置 nodemon 来监视 webpack.config.js,但它抛出一个错误
yarn run v1.9.4
$ nodemon --watch webpack.config.js ./node_modules/.bin/webpack-dev-server
[33m[nodemon] 1.18.3[39m
[33m[nodemon] to restart at any time, enter `rs`[39m
[33m[nodemon] watching: webpack.config.js[39m
[32m[nodemon] starting `node ./node_modules/.bin/webpack-dev-server`[39m
[31m[nodemon] app crashed - waiting for file changes before starting...[39m
和
throw new Error(`Encore.${prop}() cannot be called yet because the runtime environment doesn't appear to be configured. Make sure you're using the encore executable or call Encore.configureRuntimeEnvironment() first if you're purposely not calling Encore directly.`);
我觉得我缺少一个简单的命令,但我似乎找不到它。这就是我在 package.json
中使用的 "start": "nodemon --watch webpack.config.js ./node_modules/.bin/webpack-dev-server",
如果你让 watcher 监视你的文件,你只需终止该进程,然后再次 运行 watch 命令:
yarn encore dev --watch