Skip to content

Instructions to prevent CORS for Hot Module Replacement #12035

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 26, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions frontend/encore/dev-server.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,24 @@ option:
HMR currently works for :doc:`Vue.js </frontend/encore/vuejs>`, but does *not* work
for styles anywhere at this time.

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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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:
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:

What about this?


.. code-block:: terminal

$ yarn encore dev-server --port 8080 --disable-host-check --hot

Or, alternatively, you can add the options to your package.json
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Or, alternatively, you can add the options to your package.json
Or, alternatively, you can add the options to your package.json:


.. code-block:: package.json

"dev-server": "encore dev-server --port 8080 --disable-host-check",

and run the yarn command as normal:

.. code-block:: terminal

$ yarn dev-server --hot


.. _`webpack-dev-server`: https://webpack.js.org/configuration/dev-server/
.. _`HMR`: https://webpack.js.org/concepts/hot-module-replacement/