Skip to content

Commit 62f708f

Browse files
authored
Configuration for versioning, when rebinding the host from dev-server to all interfaces
This is the discussion, for setting an absolute url as publicPath, when you're binding the dev server not to localhost but to any external interface (0.0.0.0) and disable host checking. This is the related discussion: symfony/webpack-encore#96 best regards philipp
1 parent c831050 commit 62f708f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

frontend/encore/dev-server.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,20 @@ to bind to all IP addresses and allow any host to access the server:
3636
3737
You can now access the dev-server using the IP address to your virtual machine on
3838
port 8080 - e.g. http://192.168.1.1:8080.
39+
If you've activated the :ref:`manifest.json versioning <load-manifest-files>` you need additional configuration to alter the url used in your templates to the ``dev-server``:
40+
41+
.. code-block:: javascript
42+
43+
if (!Encore.isProduction()) {
44+
Encore
45+
.setPublicPath('http://192.168.1.1:8080')
46+
.setManifestKeyPrefix('build/')
47+
}
48+
49+
You'll receive a warning, when starting the ``dev-server``, that you used an absolute url for the publicPath.
50+
51+
When you're using the ``dev-server`` in a docker container, configure accordingly and map the port from the ``dev-server`` (default 8080) onto a port on the host and provide this port on the host in the url used in the call to ``.setPublicPath`` above.
52+
3953

4054
Hot Module Replacement HMR
4155
--------------------------

0 commit comments

Comments
 (0)