Dan185
Dan185

Reputation: 356

How to restart Encore after making changes to webpack.config.js

I'm using Symfony with Encore and after reading through this article, it says to restart encore after making changes but I can't find the command to do so. I tried setting up nodemon to watch webpack.config.js and it throws an error

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

and

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.`);

I feel like there's a simple command I'm missing but I can't seem to find it. This is what I'm using in package.json

   "start": "nodemon --watch webpack.config.js ./node_modules/.bin/webpack-dev-server",

Upvotes: 4

Views: 10151

Answers (2)

Glenn
Glenn

Reputation: 34

Extra tip on Chip Dean's answer: To 'terminate' the running process of encore dev --watch, you'll need to ctrl+c

Upvotes: 1

Chip Dean
Chip Dean

Reputation: 4302

If you have the watcher watching your files you just have to terminate that process and then run the watch command again:

yarn encore dev --watch

Upvotes: 9

Related Questions