You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You may encounter some issues when using Encore in a virtual machine, like VirtualBox or VMWare.
4
+
Encore is compatible with virtual machines such as `VirtualBox`_ and `VMWare`_
5
+
but you may need to make some changes to your configuration to make it work.
5
6
6
-
Fix watching issues
7
-
-------------------
7
+
File Watching Issues
8
+
--------------------
8
9
9
-
When using a virtual machine, your project root directory is shared with the virtual machine with `NFS`_.
10
-
This is really useful, but it introduces some issues with files watching.
11
-
12
-
You must enable `polling`_ option to make it work:
10
+
When using a virtual machine, your project root directory is shared with the
11
+
virtual machine using `NFS`_. This introduces issues with files watching, so
12
+
you must enable the `polling`_ option to make it work:
13
13
14
14
.. code-block:: javascript
15
15
@@ -19,30 +19,33 @@ You must enable `polling`_ option to make it work:
19
19
20
20
// will be applied for `encore dev --watch` and `encore dev-server` commands
21
21
Encore.configureWatchOptions(watchOptions=> {
22
-
watchOptions.poll=250; // check for changes every 250 ms
22
+
watchOptions.poll=250; // check for changes every 250 milliseconds
23
23
});
24
24
25
-
Fix development server
26
-
----------------------
25
+
Development Server Issues
26
+
-------------------------
27
27
28
-
Configure public path
29
-
~~~~~~~~~~~~~~~~~~~~~
28
+
Configure the Public Path
29
+
~~~~~~~~~~~~~~~~~~~~~~~~~
30
30
31
31
.. note::
32
32
33
-
You can skip this sub-section if your app is running on ``http://localhost``
34
-
and not a custom local domain-name like ``http://app.vm``.
33
+
You can skip this section if your application is running on
34
+
``http://localhost`` instead a custom local domain-name like
35
+
``http://app.vm``.
35
36
36
-
When running the development server, you will probably face the following errors in the web console:
37
+
When running the development server, you will probably see the following errors
38
+
in the web console:
37
39
38
40
.. code-block:: text
39
41
40
42
GET http://localhost:8080/build/vendors~app.css net::ERR_CONNECTION_REFUSED
41
43
GET http://localhost:8080/build/runtime.js net::ERR_CONNECTION_REFUSED
42
44
...
43
45
44
-
If your Symfony application is running on ``http://app.vm``, you must configure the public path explicitly
45
-
in your ``package.json``:
46
+
If your Symfony application is running on a custom domain (e.g.
47
+
``http://app.vm``), you must configure the public path explicitly in your
48
+
``package.json``:
46
49
47
50
.. code-block:: diff
48
51
@@ -55,20 +58,23 @@ in your ``package.json``:
55
58
}
56
59
}
57
60
58
-
After restarting Encore and reloading your web page, you will probably face different issues:
61
+
After restarting Encore and reloading your web page, you will probably see
62
+
different issues in the web console:
59
63
60
64
.. code-block:: text
61
65
62
66
GET http://app.vm:8080/build/vendors~app.css net::ERR_CONNECTION_REFUSED
63
67
GET http://app.vm:8080/build/runtime.js net::ERR_CONNECTION_REFUSED
64
68
65
-
Encore understood our modification but it's still not working. There is still two things to do.
69
+
You still need to make other configuration changes, as explained in the
70
+
following sections.
66
71
67
-
Allow external access
72
+
Allow External Access
68
73
~~~~~~~~~~~~~~~~~~~~~
69
74
70
-
You must configure how you run the `webpack-dev-server`_.
71
-
This can easily be done in your ``package.json`` by adding ``--host 0.0.0.0`` argument:
75
+
Add the ``--host 0.0.0.0`` argument to the ``dev-server`` configuration in your
76
+
``package.json`` file to make the development server accept all incoming
77
+
connections:
72
78
73
79
.. code-block:: diff
74
80
@@ -81,16 +87,16 @@ This can easily be done in your ``package.json`` by adding ``--host 0.0.0.0`` ar
81
87
}
82
88
}
83
89
84
-
.. warning::
90
+
.. caution::
85
91
86
-
Using ``--host 0.0.0.0`` makes your development server accept all incoming connections.
87
-
Be sure to run the development server inside your virtual machine and not outside, otherwise other computers can have access to it.
92
+
Make sure to run the development server inside your virtual machine only;
93
+
otherwise other computers can have access to it.
88
94
89
-
Fix "Invalid Host header" issue
95
+
Fix "Invalid Host header" Issue
90
96
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
91
97
92
-
Webpack will respond ``Invalid Host header`` when trying to access files from the dev-server.
93
-
To fix this, add the argument ``--disable-host-check``:
98
+
Webpack will respond ``Invalid Host header`` when trying to access files from
99
+
the dev-server. To fix this, add the argument ``--disable-host-check``:
94
100
95
101
.. code-block:: diff
96
102
@@ -103,10 +109,13 @@ To fix this, add the argument ``--disable-host-check``:
103
109
}
104
110
}
105
111
106
-
.. warning::
112
+
.. caution::
107
113
108
-
This is usually not recommended to disable host checking, `more information here <https://webpack.js.org/configuration/dev-server/#devserverdisablehostcheck>`_.
114
+
Beware that `it's not recommended to disable host checking`_ in general, but
115
+
here it's required to solve the issue when using Encore in a virtual machine.
0 commit comments