Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 892bbda

Browse filesBrowse files
committed
Rewords
1 parent 69d3aa8 commit 892bbda
Copy full SHA for 892bbda

File tree

1 file changed

+40
-31
lines changed
Filter options

1 file changed

+40
-31
lines changed

‎frontend/encore/virtual-machine.rst

Copy file name to clipboard
+40-31Lines changed: 40 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
Using Encore in a Virtual Machine
22
=================================
33

4-
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.
56

6-
Fix watching issues
7-
-------------------
7+
File Watching Issues
8+
--------------------
89

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:
1313

1414
.. code-block:: javascript
1515
@@ -19,30 +19,33 @@ You must enable `polling`_ option to make it work:
1919
2020
// will be applied for `encore dev --watch` and `encore dev-server` commands
2121
Encore.configureWatchOptions(watchOptions => {
22-
watchOptions.poll = 250; // check for changes every 250 ms
22+
watchOptions.poll = 250; // check for changes every 250 milliseconds
2323
});
2424
25-
Fix development server
26-
----------------------
25+
Development Server Issues
26+
-------------------------
2727

28-
Configure public path
29-
~~~~~~~~~~~~~~~~~~~~~
28+
Configure the Public Path
29+
~~~~~~~~~~~~~~~~~~~~~~~~~
3030

3131
.. note::
3232

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``.
3536

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:
3739

3840
.. code-block:: text
3941
4042
GET http://localhost:8080/build/vendors~app.css net::ERR_CONNECTION_REFUSED
4143
GET http://localhost:8080/build/runtime.js net::ERR_CONNECTION_REFUSED
4244
...
4345
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``:
4649

4750
.. code-block:: diff
4851
@@ -55,20 +58,23 @@ in your ``package.json``:
5558
}
5659
}
5760
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:
5963

6064
.. code-block:: text
6165
6266
GET http://app.vm:8080/build/vendors~app.css net::ERR_CONNECTION_REFUSED
6367
GET http://app.vm:8080/build/runtime.js net::ERR_CONNECTION_REFUSED
6468
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.
6671

67-
Allow external access
72+
Allow External Access
6873
~~~~~~~~~~~~~~~~~~~~~
6974

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:
7278

7379
.. code-block:: diff
7480
@@ -81,16 +87,16 @@ This can easily be done in your ``package.json`` by adding ``--host 0.0.0.0`` ar
8187
}
8288
}
8389
84-
.. warning::
90+
.. caution::
8591

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.
8894

89-
Fix "Invalid Host header" issue
95+
Fix "Invalid Host header" Issue
9096
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9197

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``:
94100

95101
.. code-block:: diff
96102
@@ -103,10 +109,13 @@ To fix this, add the argument ``--disable-host-check``:
103109
}
104110
}
105111
106-
.. warning::
112+
.. caution::
107113

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.
109116

117+
.. _`VirtualBox`: https://www.virtualbox.org/
118+
.. _`VMWare`: https://www.vmware.com
110119
.. _`NFS`: https://en.wikipedia.org/wiki/Network_File_System
111120
.. _`polling`: https://webpack.js.org/configuration/watch/#watchoptionspoll
112-
.. _`webpack-dev-server`: https://webpack.js.org/configuration/dev-server/
121+
.. _`it's not recommended to disable host checking`: https://webpack.js.org/configuration/dev-server/#devserverdisablehostcheck

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.