From a68e1333d53e1b5f77a08324f1231beea34c69e3 Mon Sep 17 00:00:00 2001 From: Lambert Beekhuis Date: Fri, 26 Jul 2019 10:21:32 +0200 Subject: [PATCH] Adding instructions to prevent CORS errors --- frontend/encore/dev-server.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/frontend/encore/dev-server.rst b/frontend/encore/dev-server.rst index a29e6f5e903..c31122bd7b0 100644 --- a/frontend/encore/dev-server.rst +++ b/frontend/encore/dev-server.rst @@ -39,5 +39,24 @@ option: HMR currently works for :doc:`Vue.js `, 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: + +.. code-block:: terminal + + $ yarn encore dev-server --port 8080 --disable-host-check --hot + +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/