更改webpack.config.js后如何重新启动Encore

时间:2018-08-21 22:24:19

标签: symfony webpack webpack-dev-server

我正在将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",

1 个答案:

答案 0 :(得分:4)

如果让观察者监视文件,则只需终止该过程,然后再次运行watch命令:

yarn encore dev --watch