-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Conversation
Thanks for taking the time to open a PR!
|
Test summaryRun details
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 |
import { merge } from 'webpack-merge' | ||
import defaultWebpackConfig from './webpack.config' | ||
import LazyCompilePlugin from 'lazy-compile-webpack-plugin' |
There was a problem hiding this comment.
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') }, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this 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.
There was a problem hiding this 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') }, |
There was a problem hiding this comment.
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.
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 |
Before:
After:
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).