@@ -21,12 +21,18 @@ you're done: the paths in your templates will automatically point to the dev ser
2121dev-server Options
2222------------------
2323
24+ .. caution ::
25+
26+ Encore uses ``webpack-dev-server `` version 4, which at the time of Encore's
27+ 1.0 release was still in beta and was not documented. See the `4.0 CHANGELOG `_
28+ for changes.
29+
2430The ``dev-server `` command supports all the options defined by `webpack-dev-server `_.
2531You can set these options via command line options:
2632
2733.. code-block :: terminal
2834
29- $ yarn encore dev-server --https -- port 9000
35+ $ yarn encore dev-server --port 9000
3036
3137 You can also set these options using the ``Encore.configureDevServerOptions() ``
3238method in your ``webpack.config.js `` file:
@@ -58,26 +64,27 @@ If you're using the :doc:`Symfony web server </setup/symfony_server>` locally wi
5864you'll need to also tell the dev-server to use HTTPS. To do this, you can reuse the Symfony web
5965server SSL certificate:
6066
61- .. code-block :: javascript
67+ .. code-block :: diff
6268
6369 // webpack.config.js
6470 // ...
65- const path = require (' path' );
71+ + const path = require('path');
6672
6773 Encore
6874 // ...
6975
70- .configureDevServerOptions (options => {
71- options .https = {
72- pfx: path .join (process .env .HOME , ' .symfony/certs/default.p12' ),
73- }
74- })
76+ + .configureDevServerOptions(options => {
77+ + options.https = {
78+ + pfx: path.join(process.env.HOME, '.symfony/certs/default.p12'),
79+ + }
80+ + })
7581
76- Then make sure you run the ``dev-server `` with the ``--https `` option:
7782
78- .. code-block :: terminal
83+ .. caution ::
7984
80- $ yarn encore dev-server --https
85+ Make sure to **not ** pass the ``--https `` flag at the command line when
86+ running ``encore dev-server ``. This flag was required before 1.0, but now
87+ will cause your config to be overridden.
8188
8289CORS Issues
8390-----------
@@ -116,4 +123,5 @@ your page. HMR works automatically with CSS (as long as you're using the
116123 CSS. That is no longer needed.
117124
118125.. _`webpack-dev-server` : https://webpack.js.org/configuration/dev-server/
119- .. _`it's not recommended to disable the firewall` : https://webpack.js.org/configuration/dev-server/#devserverdisablehostcheck
126+ .. _`it's not recommended to disable the firewall` : https://webpack.js.org/configuration/dev-server/#devserverdisablehostcheck
127+ .. _`4.0 CHANGELOG` : https://github.com/webpack/webpack-dev-server/blob/master/CHANGELOG.md#400-beta0-2020-11-27
0 commit comments