You are browsing the documentation for Symfony 4.2 which is not maintained anymore.
Consider upgrading your projects to Symfony 5.3.
Using webpack-dev-server and HMR
Using webpack-dev-server and HMR¶
While developing, instead of using
yarn encore dev --watch, you can use the
$ yarn encore dev-server
This serves the built assets from a new server at
http://localhost:8080 (it does
not actually write any files to disk). This means your
need to change to point to this.
If you’re using the
Twig shortcuts (or are processing your assets through entrypoints.json
in some other way), you’re done: the paths in your templates will automatically point
to the dev server.
You can also pass options to the
dev-server command: any options that are supported
by the normal webpack-dev-server. For example:
$ yarn encore dev-server --https --port 9000
This will start a server at
This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.