-
Notifications
You must be signed in to change notification settings - Fork 11.9k
perf(@angular/cli): fix unnecessary esbuild rebuilds #30234
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
perf(@angular/cli): fix unnecessary esbuild rebuilds #30234
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
clydin
left a comment
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.
Can you update the scope to be @angular/build instead of @angular/cli?
Otherwise, LGTM.
Thank you for the contribution.
When using esbuild, Angular sets up a custom file watcher using esbuilds metafile inputs. Esbuild will generate <define:KEY> entries see https://esbuild.github.io/try/#YgAwLjI1LjMALS1kZWZpbmU6Rk9PPSd7fScgLS1tZXRhZmlsZSAtLWJ1bmRsZQBlAGVudHJ5LmpzAGNvbnNvbGUubG9nKEZPTyk. After the build is finished, the file watcher will notice that the <define:KEY> entries no longer exist on the file system and trigger a rebuild even though no files have changed. This change, fixes the above issue by filtering files starting with `<define:`.
b4bfb44 to
85dc594
Compare
|
I changed the scope to |
|
The changes were merged into the following branches: main, 19.2.x, 20.0.x |
|
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. |
PR Checklist
Please check to confirm your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
When using esbuild, Angular sets up a custom file watcher using esbuilds metafile inputs. Esbuild will generate define:KEY entries see https://esbuild.github.io/try/#YgAwLjI1LjMALS1kZWZpbmU6Rk9PPSd7fScgLS1tZXRhZmlsZSAtLWJ1bmRsZQBlAGVudHJ5LmpzAGNvbnNvbGUubG9nKEZPTyk. After the build is finished, the file watcher will notice that the define:KEY entries no longer exist on the file system and trigger a rebuild even though no files have changed.
Issue Number: N/A
What is the new behavior?
No rebuilds are triggered since the file watcher is no longer tracking changes to define:KEY entries.
Does this PR introduce a breaking change?
Other information
There other conditions which may also trigger a rebuilds, because the file watcher is tracking all inputs from the metafile, which are not necessarily files. This esbuild plugin example will also trigger a rebuild because esbuild will add the
ns-envnamespace to the metafile inputs.