Skip to content
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

Upgrade to latest config from webpack-dev-server v4.0.0-rc.0 #310

Merged
merged 5 commits into from
Jul 21, 2021

Conversation

alexristich
Copy link
Contributor

Resolves #309

I'm guessing this would be considered a major release given it'd break for anyone who might still be using webpack-dev-server v3.x.x (or anyone who's pinned to a beta release of webpack-dev-server v4.0.0-beta(x).

Happy to make any changes, just thought I'd kick off a PR to hopefully save some time in getting this fixed :)

@changeset-bot
Copy link

changeset-bot bot commented Jul 20, 2021

🦋 Changeset detected

Latest commit: a31d474

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
webpack-config-single-spa Major
webpack-config-single-spa-react Patch
webpack-config-single-spa-ts Patch
webpack-config-single-spa-react-ts Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Member

@joeldenning joeldenning left a comment

Choose a reason for hiding this comment

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

Thanks for your help in reporting the issue, identifying the cause, and contributing a fix. I've pushed a couple commits to this PR to fix up the following:

  • The version of webpack-dev-server in newly generated package.jsons should be 4.0.0-rc.0
  • The client.host property was renamed to client.webSocketURL.hostname - it was not removed. It's important because otherwise the web socket connectino from the browser to webpack-dev-server will not work since it will make the request relative to the html page (root config) rather than the microfrontend's webpack-dev-server.

I also agree this is a breaking change and will publish it as a new major for webpack-config-single-spa

@@ -85,15 +85,16 @@ function webpackConfigSingleSpa(opts) {
},
devtool: "source-map",
devServer: {
compress: true,
Copy link
Member

Choose a reason for hiding this comment

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

I confirmed that this is the new default value in webpack-dev-server and that gzip compression still occurs with this change.

@joeldenning joeldenning merged commit 5dc82a6 into single-spa:main Jul 21, 2021
@joeldenning
Copy link
Member

joeldenning commented Jul 21, 2021

Released in webpack-config-single-spa@4.0.0. See https://github.com/single-spa/create-single-spa/blob/main/packages/webpack-config-single-spa/CHANGELOG.md#400 for migration instructions

@alexristich
Copy link
Contributor Author

Thanks for tidying this up! Haven't worked with pnpm before so I was reluctant to commit the pnpm-lock.yaml file in the first commit. I see now I had no reason to worry. :)

The client.host property was renamed to client.webSocketURL.hostname - it was not removed. It's important because otherwise the web socket connectino from the browser to webpack-dev-server will not work since it will make the request relative to the html page (root config) rather than the microfrontend's webpack-dev-server.

Ah, of course. I couldn't figure out where it went and thought this might have been superseded by host which has a default value of localhost. Your explanation makes way more sense - thanks!

@alexristich alexristich deleted the webpack-dev-server-fixes branch July 21, 2021 04:21
@joeldenning
Copy link
Member

I couldn't figure out where it went and thought this might have been superseded by host which has a default value of localhost

Yeah I wasn't sure if host's default value would be enough, but in local testing it was not, unfortunately. I think ideally we wouldn't need to specify client.webSocketURL.hostname, but it seems required for now.

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.

Dev server failing
3 participants