Skip to content

Honor --public flag given to 'yarn run dev-server ...' #529

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

Merged
merged 2 commits into from
Mar 1, 2019

Conversation

lyrixx
Copy link
Member

@lyrixx lyrixx commented Feb 24, 2019

I'm using docker (one container for the front, another one for webpack)
and I had to do this PR to make it work.

For reference, this is the command I (docker actually) executed

yarn run dev-server --host 0.0.0.0 --port 9999 --hot --public https://example.com:443 --disable-host-check

Copy link
Collaborator

@Lyrkan Lyrkan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @lyrixx,

That's definitely an issue, however we may require a bit more code here.

The example given in the dev-server doc doesn't specify the protocol, so I guess most people will try using that option without it... which breaks the manifest.json/entrypoints.json files.

For instance:

$ yarn encore dev-server --host 0.0.0.0 --port 8080 --public foo.local:80
// manifest.json
{
  "main.css": "foo.local:80/main.css",
  "main.js": "foo.local:80/main.js",
}
// entrypoints.json
{
  "entrypoints": {
    "main": {
      "css": [
        "foo.local:80/main.css"
      ],
      "js": [
        "foo.local:80/main.js"
      ]
    }
  }
}

I guess we should also look if the protocol is present in the value of --public and add it if necessary (there is also the --https option to take into account for that case).

@lyrixx
Copy link
Member Author

lyrixx commented Feb 24, 2019

Thanks for the review. I updated the PR. Is it better?

Copy link
Collaborator

@Lyrkan Lyrkan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it seems to work perfectly, thank you :)

Just a small thing left to avoid an error when --public isn't followed by a string (argv.public becomes a boolean in that case, so .includes(...) doesn't work).

@weaverryan
Copy link
Member

Nice one @lyrixx! Thank you!

@weaverryan weaverryan merged commit 5fb19de into symfony:master Mar 1, 2019
weaverryan added a commit that referenced this pull request Mar 1, 2019
…xx, Lyrkan)

This PR was merged into the master branch.

Discussion
----------

Honor --public flag given to 'yarn run dev-server ...'

I'm using docker (one container for the front, another one for webpack)
and I had to do this PR to make it work.

For reference, this is the command I (docker actually) executed
```
yarn run dev-server --host 0.0.0.0 --port 9999 --hot --public https://example.com:443 --disable-host-check
```

Commits
-------

5fb19de Update lib/config/parse-runtime.js
4275ff0 Honor --public flag given to 'yarn run dev-server ...'
@lyrixx lyrixx deleted the public branch March 1, 2019 16:41
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

Successfully merging this pull request may close these issues.

3 participants