Skip to content

Webpack Dev Server with Devilbox #782

Open
@ptmrio

Description

@ptmrio

ISSUE TYPE

  • Documentation

SUMMARY

As webpack-dev-server gets more popular and is also a big part of Symfony's webpack encore, I would kindly ask for a proper documentation of a correct setup.

Currently I need to add the following:

docker-compose.override.yml

version: '2.3'

################################################################################
# SERVICES
################################################################################
services:

  # .....

  # ------------------------------------------------------------
  # PHP
  # ------------------------------------------------------------
  php:
    ports:
      - "8080:8080" 

webpack.config.js

    .configureDevServerOptions(options => {
        options.client = {
            host: '0.0.0.0'
        };
        options.firewall = false;
        options.https = true;
    })

and also the starting command needs to be: encore dev-server --https --host 0.0.0.0

package.json

...
  "scripts": {
    "dev-server": "encore dev-server  --host 0.0.0.0 --https",
    "dev": "encore dev",
    "watch": "encore dev --watch",
    "build": "encore production --progress"
  }
...

Problems with this setup:

  • SSL connection is always invalid. Adding the devilbox certificates to the https: { ... } options object does not work
  • host needs to be included in the yarn command to start the server, else it tries to use localhost
  • also client.host needs to be specified somewhat redundantly to make the web socket working

Webpack Encore 1.0.4
Webpack 5.20.1
Webpack-dev-server: 4.0.0-beta.0
Devilbox 1.7.1

Also see: symfony/webpack-encore#828

Goal

Add a documentation guide for proper implementation of webpack-dev-server.

  • working SSL connection
  • probably with an per project webpack-dev-server (wds)? (starting wds in multiple projects simultaneously leads to problems

Would highly appreciate! Thank you for the great devilbox!

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions