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

Webpack5: Add lazy compilation #17501

Merged
merged 4 commits into from
Feb 17, 2022
Merged

Webpack5: Add lazy compilation #17501

merged 4 commits into from
Feb 17, 2022

Conversation

tmeasday
Copy link
Member

@tmeasday tmeasday commented Feb 14, 2022

What I did

Add builderOptions.lazyCompilation to allow users to opt-into webpack's lazy compilation experiment.

NOTE: this disables the "entry" compilation, as otherwise that just needs to be compiled straight away when the user visits the SB anyway.

TODO

  • Disable in build mode
  • Fix webpack issue with story files that import each other
  • Investigate/fix issue with enabling fs cache + lazy compilation in larger projects.

How to test

// in main.js

core: {
  builder: {
    name: 'webpack5',
    lazyCompilation: true,
  }
}

@nx-cloud
Copy link

nx-cloud bot commented Feb 14, 2022

☁️ Nx Cloud Report

CI ran the following commands for commit 3052b90. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

As it conflicts with lazy compilation
@tmeasday
Copy link
Member Author

@shilman I am going to investigate the third point on a separate time-scale, I think this is good to merge.

@shilman shilman marked this pull request as ready for review February 16, 2022 06:59
@shilman shilman changed the title Add lazy compilation Webpack5: Add lazy compilation Feb 16, 2022
lib/builder-webpack5/src/preview/base-webpack.config.ts Outdated Show resolved Hide resolved
lib/builder-webpack5/src/preview/base-webpack.config.ts Outdated Show resolved Hide resolved
@@ -32,6 +32,7 @@ export interface Webpack5BuilderConfig extends BuilderConfigObject {
name: 'webpack5';
options?: {
fsCache?: boolean;
lazyCompilation?: boolean;
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to document this somewhere?

Copy link
Member Author

Choose a reason for hiding this comment

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

I have a separate ticket to do this, do you want to hold the PR for it?

Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

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

Great job @tmeasday!! 🚀

@shilman shilman merged commit d286d4f into next Feb 17, 2022
@shilman shilman deleted the add-lazy-compilation branch February 17, 2022 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants