-
Notifications
You must be signed in to change notification settings - Fork 12k
Add a Build Optimizer plugin to filter which files are processed #14998
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
Conversation
packages/angular_devkit/build_optimizer/src/build-optimizer/webpack-loader.ts
Outdated
Show resolved
Hide resolved
c4bfb2f
to
fe2f42d
Compare
Compared the effect on AIO and saw some bundles became slightly smaller, sourcemaps also smaller, but main bundle 5kb large. Looking into why main is larger. |
da05c99
to
af590db
Compare
Looking through the AIO sourcemaps and changing what files were skipped, I could see that the 5kb difference in main was due to skipping ngfactories (4kb) and skipping app files (1kb). Made changes to ensure those are never skipped. I am a bit surprised that made a difference. Maybe the app has unneeded imports? With the current changes, the AIO size does not change at all. Some sourcemaps get up to 2kb smaller, which is good because it is less sourcemap to process. The following files are skipped by BO altogether:
This is good because they really should never be processed. AIO includes a very small amount of third party non-TS libraries so the isn't a big change to processing time or memory used. But most projects use many third party JS libraries. Some of these can be quite large and take a long time to be processed by BO. Often they also have language constructs that BO can break on. So it's good that we can minimize the processing. |
In #13734 (comment) I benchmarked a large project with BO:
Without BO:
Without BO build time dropped by ~170s and average/peak memory usage dropped by ~500mb. And then with the BO changes in this PR:
So a bit less, but not that much, which surprised me. I guess some of the other options we turn on with build optimizer might be a bit more impactful, like I did a couple single run benchmarks to check, still using the contents of this PR. With
With
With both
Between those two, it looks like |
) { | ||
// Only TS packages should use Build Optimizer. | ||
const typings = resolveData.descriptionFileData.typings; | ||
// Note: a TS package might not have defined typings but still use .d.ts files next to |
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.
Maybe an additional note that this will also enable build optimizer for JS origin packages that happen to have a typings file?
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.
Yes, that's another limitation. Added.
Using this webpack allows determining in advance if files from a package should be skipped by the Build Optimizer loader.
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the ℹ️ Googlers: Go here for more info. |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
No description provided.