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

feat: Improve webpack-dev-server performance #15158

Merged
merged 9 commits into from
Feb 22, 2021

Conversation

dmtrKovalenko
Copy link
Contributor

@dmtrKovalenko dmtrKovalenko commented Feb 19, 2021

Before:

image

After:

image

So the timings, after all, are much better – this is for the initial request when we bundling the heaviest spec of @cypress/react (mui autocomplete).

image

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Feb 19, 2021

Thanks for taking the time to open a PR!

@dmtrKovalenko dmtrKovalenko marked this pull request as draft February 19, 2021 12:36
@cypress
Copy link

cypress bot commented Feb 19, 2021



Test summary

3977 0 49 2


Run details

Project cypress
Status Passed
Commit fe2a5ae
Started Feb 22, 2021 10:17 AM
Ended Feb 22, 2021 10:27 AM
Duration 09:45 💡
OS Linux Debian - 10.5
Browser Chrome 83

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@dmtrKovalenko dmtrKovalenko requested a review from a team February 19, 2021 14:31
import { merge } from 'webpack-merge'
import defaultWebpackConfig from './webpack.config'
import LazyCompilePlugin from 'lazy-compile-webpack-plugin'
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the one: https://github.com/liximomo/lazy-compile-webpack-plugin ?

I'm surprised more people are not using this 🤔 seems not well known

@@ -17,7 +19,7 @@ const webpackConfig = {
{
test: /\.(js|jsx|mjs|ts|tsx)$/,
loader: 'babel-loader',
options: babelConfig,
options: { ...babelConfig, cacheDirectory: path.resolve(__dirname, '..', '..', '.babel-cache') },
Copy link
Contributor

@lmiller1990 lmiller1990 Feb 19, 2021

Choose a reason for hiding this comment

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

What is this? Is this just to speed up CI?

Copy link
Contributor

Choose a reason for hiding this comment

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

And show users how to optimize theirs.

case 4:
return { plugins: [new LazyCompilePlugin()] }
case 5:
return { experiments: { lazyCompilation: true } } as webpack.Configuration
Copy link
Contributor

Choose a reason for hiding this comment

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

Right - so webpack 5 has lazy built in, but webpack 4 you need the plugin?

Copy link
Contributor Author

@dmtrKovalenko dmtrKovalenko Feb 19, 2021

Choose a reason for hiding this comment

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

I think this should be clear from the code <3

Happy that my code is readable :D

lmiller1990
lmiller1990 previously approved these changes Feb 19, 2021
Copy link
Contributor

@lmiller1990 lmiller1990 left a comment

Choose a reason for hiding this comment

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

The code seems fine, I did not get a chance to test it out locally - left some comments which are more general questions for my understanding.

@dmtrKovalenko dmtrKovalenko marked this pull request as ready for review February 19, 2021 16:28
Copy link
Contributor

@elevatebart elevatebart left a comment

Choose a reason for hiding this comment

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

I like it !!

@@ -17,7 +19,7 @@ const webpackConfig = {
{
test: /\.(js|jsx|mjs|ts|tsx)$/,
loader: 'babel-loader',
options: babelConfig,
options: { ...babelConfig, cacheDirectory: path.resolve(__dirname, '..', '..', '.babel-cache') },
Copy link
Contributor

Choose a reason for hiding this comment

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

And show users how to optimize theirs.

@dmtrKovalenko
Copy link
Contributor Author

There is also a small UI defect – because compilation happens on the flight (if it takes more than a second user seeing a blink to the white screen).

Screen.Recording.2021-02-22.at.11.42.28.mov

@dmtrKovalenko dmtrKovalenko merged commit f237050 into develop Feb 22, 2021
@elevatebart elevatebart deleted the feat/webpack-dev-server-performance branch March 19, 2021 00:47
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