Skip to content

Webpack server options not used to define entrypoints url #1117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gillesdalle opened this issue May 13, 2022 · 2 comments
Closed

Webpack server options not used to define entrypoints url #1117

gillesdalle opened this issue May 13, 2022 · 2 comments

Comments

@gillesdalle
Copy link
Contributor

Hello,

To configure the webpack dev-server, I use the configureDevServerOptions method in the webpack.config.js file :

Encore.
  .configureDevServerOptions((options) => {
    options.server = {
      type: "https",
      options: {
        key: ".....",
        cert: "....."
      },
    };
    options.host = "0.0.0.0";
    options.port = "3000";
    options.hot = true;
    options.allowedHosts = "all";
  })
  ......

The probleme is that in the generated entrypoints.json file, all urls start with http://localhost:8080/build/.
The server configuration options are not used

If I use the cli params, urls in the entrpoints file are OK :

encore dev-server --host 0.0.0.0 --port 3000
# => urls in entrypoinys.json start with 'http://0.0.0.0:3000/'

Is this a bug or have i missing something ?

Thanks

@weaverryan
Copy link
Member

Hmm, that's a good question. The intended way to set the host or port is via the command-line options. We intercept those and use them in other places (like figuring out the paths for the entrypoints). What we don't do is read the dev server options that you've set (e.g. options.host) and then use those later.

We could do this. But for simplicity, I'd rather people pass them as command line args. If you don't want to pass them every time you run the command (I don't blame you), I'd leverage scripts inside of package.json - e.g. https://symfony.com/doc/current/frontend/encore/virtual-machine.html#allow-external-access

Cheers!

@bernhardberger
Copy link

this breaks wbpack configs with multiple builds if you want to use the dev-server...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants