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

[BUILD] Support dependency hoisting #7891

Merged

Conversation

mgadewoll
Copy link
Contributor

@mgadewoll mgadewoll commented Jul 18, 2024

Summary

This PR enables dependency hoisting on root level via nmHoistingLimits: none in the .yarnrc.yml.
This ensures that the /docusaurus-theme and /website packages resolve shared dependencies properly.

To not break the existing build of the /eui package, this package is excluded from the hoisting by setting "hoistingLimits": "workspaces" in it's package.json which ensures its dependencies are not hoisted beyond its workspace scope.

Note

This update fixes the issue we encountered with Docusaurus ejected components for EUI+ that were relying on a specific context and were incorrectly using a different instance of the expected provider, resulting in errors like: Hook useNavbarMobileSidebar is called outside the <NavbarMobileSidebarProvider>.

Screenshot 2024-07-18 at 13 52 04

QA

  • checkout this PR gh pr checkout 7891 and ensure the usual scripts work
    • yarn start
    • yarn storybook
    • yarn build-storybook
    • yarn build-docs
    • yarn build
    • yarn build-pack
    • yarn test-ci
  • verify that the EUI docs, Storybook and EUI+ deployments work as expected

- enables root level dependency hoisting but excludes EUI package to ensure existing functionality
@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

@mgadewoll mgadewoll marked this pull request as ready for review July 18, 2024 12:13
@mgadewoll mgadewoll requested a review from a team as a code owner July 18, 2024 12:13
Copy link
Contributor

@cee-chen cee-chen left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you for the super thorough PR description - that all makes sense to me and I think the workaround works great!

Copy link
Member

@tkajtoch tkajtoch left a comment

Choose a reason for hiding this comment

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

Tested locally and discussed during our sync today. Works like a charm!

@mgadewoll mgadewoll merged commit e35371e into elastic:main Jul 18, 2024
9 checks passed
@mgadewoll mgadewoll deleted the feat/support-partial-dependency-hoisting branch July 18, 2024 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants