-
Notifications
You must be signed in to change notification settings - Fork 11.9k
fix(@angular-devkit/build-angular): handle basename collisions #28797
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
b8d35eb
to
7916cb8
Compare
7916cb8
to
5ca8cb8
Compare
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 use of a Map
to explicitly define output entry points seems generally reasonable. But I'm wondering if we should allow Set
at all? I think this was already an issue for the Jest and WTR builders which I hadn't gotten to fixing yet and it makes me think we should never use the Set
case as its implemented today or we'll potentially run into the same bug. I'm thinking we should either:
- Remove
Set
from the parameter type altogether and require aMap
. All callers need to manually construct thisMap
. - Update
normalizeEntryPoints
to find and deduplicate basenames in the set (foo.spec.js
becomesfoo.spec-2.js
) so the caller doesn't need to worry about this.
I'd probably lean towards 2., given that Jest and WTR are likely to duplicate the work done in the Karma builder, and if we go with 2. they likely wouldn't need to worry about this given that none of the test runners really care about the output file name too much.
packages/angular_devkit/build_angular/src/builders/karma/application_builder.ts
Show resolved
Hide resolved
A potential issue with 2 is that the test runners (or, at least Karma) need to be able to find the entrypoints afterwards to load them. Which makes me lean towards refactoring the Jest/WTR builders to use the Map as well. Either way, happy to do a potential follow-up if necessary to ensure that we only have one or the other at the end of this. Agreed that we should pick one data structure, not both. |
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.
A potential issue with 2 is that the test runners (or, at least Karma) need to be able to find the entrypoints afterwards to load them. Which makes me lean towards refactoring the Jest/WTR builders to use the Map as well.
I did have a similar thought, but I feel it's manageable if we either maintain the relevant extension (.spec.js
), though that might be a little tricky without codifying that particular extension into application
builder, or we could potentially dump these into a subdirectory like dist/entry-points/...
where the exact file name doesn't matter because all the entry points are there instead of dist/chunk-*.js
. Not sure exactly which of these would be easier, but it's a potential option.
I'm fine to tackle that as a follow up, it would definitely be great to have a common solution for all three test runners.
FWIW, that is a general theme for the application builder support for Karma. I've been lifting code (e.g. |
5ca8cb8
to
4f8872b
Compare
4f8872b
to
18d0cce
Compare
The changes were merged into the following branches: main, 19.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. |
Generates unique names for each test entry point and also creates a nice & consistent name for the main ("init test bed") chunk. All specs are now
spec-*.js
files.Fixes #28756
P.S.: Current based on #28795, will rebase post-merge.