Skip to content

Commit c879d0e

Browse files
committed
Reword
1 parent eaa24a5 commit c879d0e

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

frontend/encore/dev-server.rst

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,34 +29,34 @@ This will start a server at ``https://localhost:9000``.
2929
Hot Module Replacement HMR
3030
--------------------------
3131

32-
Encore *does* support `HMR`_, but only in some areas. To activate it, pass the ``--hot``
32+
Encore *does* support `HMR`_ for :doc:`Vue.js </frontend/encore/vuejs>`, but
33+
does *not* work for styles anywhere at this time. To activate it, pass the ``--hot``
3334
option:
3435

3536
.. code-block:: terminal
3637
3738
$ ./node_modules/.bin/encore dev-server --hot
3839
39-
HMR currently works for :doc:`Vue.js </frontend/encore/vuejs>`, but does *not* work
40-
for styles anywhere at this time.
40+
If you experience issues related to CORS (Cross Origin Resource Sharing), add
41+
the ``--disable-host-check`` and ``--port`` options to the ``dev-server``
42+
command in the ``package.json`` file:
4143

42-
For Hot Module Replacement, CORS-errors can appear (Cross Origin Resource Sharing). To handle this, add the --disable-host-check and --port options to your command:
44+
.. code-block:: diff
4345
44-
.. code-block:: terminal
45-
46-
$ yarn encore dev-server --port 8080 --disable-host-check --hot
47-
48-
Or, alternatively, you can add the options to your package.json
49-
50-
.. code-block:: package.json
51-
52-
"dev-server": "encore dev-server --port 8080 --disable-host-check",
53-
54-
and run the yarn command as normal:
55-
56-
.. code-block:: terminal
46+
{
47+
...
48+
"scripts": {
49+
- "dev-server": "encore dev-server",
50+
+ "dev-server": "encore dev-server --port 8080 --disable-host-check",
51+
...
52+
}
53+
}
5754
58-
$ yarn dev-server --hot
55+
.. caution::
5956

57+
Beware that `it's not recommended to disable host checking`_ in general, but
58+
here it's required to solve the CORS issue.
6059

6160
.. _`webpack-dev-server`: https://webpack.js.org/configuration/dev-server/
6261
.. _`HMR`: https://webpack.js.org/concepts/hot-module-replacement/
62+
.. _`it's not recommended to disable host checking`: https://webpack.js.org/configuration/dev-server/#devserverdisablehostcheck

0 commit comments

Comments
 (0)