Skip to content

feat(core): upgrade to webpack-dev-server@4 - #5420

Merged
slorber merged 19 commits into
meta:mainfrom
AviVahl:webpack-dev-server-4.0.0
Oct 28, 2021
Merged

slorber merged 19 commits into
meta:mainfrom
AviVahl:webpack-dev-server-4.0.0

Conversation

@AviVahl

@AviVahl AviVahl commented Aug 25, 2021 •

Copy link
Copy Markdown

Motivation

  • current webpack-dev-server@3 has deps with known security issues.
  • v4 has been released as stable
  • use react-dev-utils@next for temporary Webpack 5 support (instead of our copied files)
  • Server /static folder with the official static option instead of an express middleware
  • Cleanup old/unused configs

Used: https://github.com/webpack/webpack-dev-server/blob/master/migration-v4.md

Have you read the Contributing Guidelines on pull requests?

yes

Test Plan

  • yarn start works with a good DX, hot reload and show new error overlay
  • CI pass tests

@AviVahl
AviVahl requested review from lex111 and slorber as code owners August 25, 2021 16:57
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Aug 25, 2021
@AviVahl

AviVahl commented Aug 25, 2021 •

Copy link
Copy Markdown
Author

TBH, I'm not sure whether the tests cover the start flow or hot reloading. Given a custom client/overlay is used, further validation of this feels needed.

The logging options were removed from DevServer itself, as it now uses webpack's logging mechanism.
It might be needed to adjust the used webpack config logging options to replicate the existing behavior.

@netlify

netlify Bot commented Aug 25, 2021 •

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Aug 25, 2021 •

Copy link
Copy Markdown

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟠 Performance 66
🟢 Accessibility 98
🟢 Best practices 100
🟢 SEO 100
🟢 PWA 95

Lighthouse ran on https://deploy-preview-5420--docusaurus-2.netlify.app/

@slorber

slorber commented Aug 26, 2021

Copy link
Copy Markdown
Collaborator

Thanks!

I am able to start the dev server successfully (yarn install && yarn start:website)

However there are a few issues:

  • Logging is much more verbose than before, how can we revert this?
  • Hot reload does not actually work (both for React and md files). I see Webpack recompiling but no browser hot reload, and a refresh is required to see the changes)

Can you add back the useless ...{} spread? We'll remove this once we get it working. In the meantime it helps to review this PR otherwise I see a larger diff than there are actual changes.

@slorber

slorber commented Aug 26, 2021 •

Copy link
Copy Markdown
Collaborator

Some random notes:

image

However, I'm not able to get rid of the following logs that we didn't have before:

image

As not all Docusaurus users are skilled frontend devs, I'd prefer not to show anything too complicated in the console ;)

@alexander-akait any idea?

@AviVahl

AviVahl commented Aug 26, 2021

Copy link
Copy Markdown
Author

Thanks for looking into this! :)

The ..{ causes excess configuration fields to not error. Since the types are much more accurate, I suggest removing it.

If you add stats: 'errors-warnings' to the webpack config, it may behave closer to what you expect I think...

@alexander-akait

Copy link
Copy Markdown

@slorber for reduce stats output you can use devServer.devMiddleware.stats, anyway what do you think extra here? We can reduce output

@slorber

slorber commented Sep 1, 2021 •

Copy link
Copy Markdown
Collaborator

Thanks

To sum-up:

I think we'll follow what CRA do and use the new Webpack overlay features

I'm on holiday in 2 days so will wait for my return to merge/release this.

@alexander-akait

Copy link
Copy Markdown

Also will be great any feedback/help with out current overlay, improving is not hard, just need some help here

@AviVahl

AviVahl commented Sep 27, 2021

Copy link
Copy Markdown
Author

I've merged main and bumped webpack-dev-server to v4.3.0. All tests pass locally.

@slorber

slorber commented Oct 7, 2021

Copy link
Copy Markdown
Collaborator

I'll make sure this PR is merged asap, just want to do a last stable release before merging it so that we have time to see dev issues by using it ourselves

@alexander-akait

Copy link
Copy Markdown

In near future I will implement eTag and Modified-Since headers for caching, so browser will be faster with getting output, especial in incremental build with caches

@slorber

slorber commented Oct 15, 2021

Copy link
Copy Markdown
Collaborator

In near future I will implement eTag and Modified-Since headers for caching, so browser will be faster with getting output, especial in incremental build with caches

Great, never thought about this in dev but it makes sense 👍 Let me know when we should upgrade and test this.


@AviVahl we just released beta.7.

If there's no major bug reported in the upcoming day I'll complete and merge this PR next week.

@slorber

slorber commented Oct 21, 2021

Copy link
Copy Markdown
Collaborator

beta.8 bugfix released, hope to merge this PR next week then 😅

@slorber slorber added the pr: new feature This PR adds a new API or behavior. label Oct 27, 2021
@slorber slorber changed the title chore(deps): upgrade to webpack-dev-server@4 feat(core): upgrade to webpack-dev-server@4 Oct 27, 2021
@slorber slorber mentioned this pull request Oct 28, 2021
"postcss-loader": "^6.1.1",
"prompts": "^2.4.1",
"react-dev-utils": "^11.0.1",
"react-dev-utils": "12.0.0-next.47",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

temporary pinning this dep, react-dev-utils package seems stable enough for usage in Docusaurus

@slorber
slorber merged commit 96da25e into meta:main Oct 28, 2021
mrizwanashiq pushed a commit to mrizwanashiq/docusaurus that referenced this pull request Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Signed Facebook CLA pr: new feature This PR adds a new API or behavior.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants