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

UMD component exports have duplicate names #4443

Closed
colinrotherham opened this issue Nov 7, 2023 · 0 comments · Fixed by #4444
Closed

UMD component exports have duplicate names #4443

colinrotherham opened this issue Nov 7, 2023 · 0 comments · Fixed by #4444
Labels
🐛 bug Something isn't working the way it should (including incorrect wording in documentation) tooling

Comments

@colinrotherham
Copy link
Contributor

Description of the issue

GOV.UK Frontend v5 beta releases include Universal Module Definition (UMD) bundles for:

  1. Entire package as all.bundle.js
  2. Individual components as accordion.bundle.js, button.bundle.js etc

This appears to be related to workarounds added (see #2426, #2829, #2899) to rename default (unnamed) exports when older Rollup releases didn't support named exports in the same bundle

See the following componentPathToModuleName() helper for context:

// Components are given names (e.g window.GOVUKFrontend.Accordion)
amd: { id: componentPathToModuleName(input) },
name: componentPathToModuleName(input)

Since we moved to named exports in b94e812 as part of #3771 we can likely remove the helper to fix the issue

Steps to reproduce the issue

When using individual component bundles, code using existing require() calls (CommonJS, AMD) or window global properties no longer work and must be updated to use duplicate names instead:

- const { Accordion } = window.GOVUKFrontend
+ const { Accordion } = window.GOVUKFrontend.Accordion
@colinrotherham colinrotherham added 🐛 bug Something isn't working the way it should (including incorrect wording in documentation) awaiting triage Needs triaging by team labels Nov 7, 2023
@colinrotherham colinrotherham self-assigned this Nov 7, 2023
@colinrotherham colinrotherham added tooling and removed awaiting triage Needs triaging by team labels Nov 8, 2023
@colinrotherham colinrotherham removed their assignment Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working the way it should (including incorrect wording in documentation) tooling
Projects
Development

Successfully merging a pull request may close this issue.

1 participant