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

Fix self references in CSS module JS assets #9080

Merged
merged 6 commits into from
Jun 8, 2023

Conversation

devongovett
Copy link
Member

If a CSS module with composes is referenced in multiple different targets, a "Bundle group cannot have more than one entry bundle of the same type" error can occur. This is caused by the self reference dependency that is created in the JS transformer for a module.exports[...] reference, which ensures the symbols are preserved. Because a CSS module creates two different assets, the resolution of the dependency in the JS asset back to itself is unclear and may resolve back to the CSS part, messing things up downstream.

This changes the self reference dependency to use the asset's uniqueKey as the specifier rather than the file name. This means the dependency is resolved directly to the JS asset rather than going through the resolver and maybe going back to the CSS part. If no uniqueKey has been set, the JS transformer will create one.

@devongovett devongovett merged commit 40bf1c2 into v2 Jun 8, 2023
@devongovett devongovett deleted the css-modules-self-reference branch June 8, 2023 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants