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(build): ensure nested external dependencies are not bundled #1566

Merged

Conversation

Francois-Esquire
Copy link
Contributor

Description

Ensures that dependencies for packages are not bundled into the distributable for our component packages. This reduces code duplication and limits multiple instances of a given library (eg date-fns) which can lead to unintended issues.

Detail

This affects any component package that uses a nested import path.

Three packages have been affected:

  • chrome: dom-helpers nested import of dom-helpers/activeElement
  • datepickers: date-fns nested imports of various utilities
  • modals: dom-helpers nested import of dom-helpers/activeElement

Checklist

  • 👌 design updates will be Garden Designer approved (add the designer as a reviewer)
  • 🌐 demo is up-to-date (yarn start)
  • ⬅️ renders as expected with reversed (RTL) direction
  • 🤘 renders as expected with Bedrock CSS (?bedrock)
  • 💂‍♂️ includes new unit tests. Maintain existing coverage (always >= 96%)
  • tested for WCAG 2.1 AA accessibility compliance
  • 📝 tested in Chrome, Firefox, Safari, and Edge

*/
external: id => externalPackages.includes(id),
external: id => externalPackages.filter(regexp => regexp.test(id)).length > 0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it valid for the value of external to be switched from a boolean return value to a filtered array? Just making sure.

Copy link
Contributor Author

@Francois-Esquire Francois-Esquire Jul 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually we still return a boolean (notice the end of line 47 ....length > 0,) using a greater than 0 expression.

@Francois-Esquire Francois-Esquire changed the title chore(build): ensure nested external dependencies are not bundled fix(build): ensure nested external dependencies are not bundled Jul 7, 2023
@Francois-Esquire Francois-Esquire merged commit 4a0977a into main Jul 10, 2023
3 of 4 checks passed
@Francois-Esquire Francois-Esquire deleted the mike/chore/ensure-dependencies-are-not-bundled branch July 10, 2023 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

4 participants