Skip to content

Conversation

@dlabaj
Copy link
Contributor

@dlabaj dlabaj commented Mar 20, 2023

Generates package.json for each components to support federated modules.

Each component will have it's own name and package json file:

e.g. (@patternfly/react-core-tile, @patternfly/react-core-dropdown-next, @patternfy/react-core-dropdown-deprecated)

resolves issue #8357

Single component imports AKA federated mini module support for tree shaking has been added to the following:

  • react-core
  • react-table
  • react-charts

TODO:

  • Add support for CJS.
  • Update package.json to run build:fed:module as part of build.
  • Complete testing.

NOTE: Module federation webpack plugin will be created in the following repo https://github.com/patternfly/module-federation-tree-shaking-plugin

@patternfly-build
Copy link
Contributor

patternfly-build commented Mar 20, 2023

@dlabaj dlabaj force-pushed the fed_module_updates branch 4 times, most recently from 02a2a82 to 787d36a Compare March 21, 2023 16:24
@dlabaj dlabaj changed the title WIP: Added code to generate esm package.json files for federated module. feat(infrastructure): Added ability import components directly to support fed modules tree-shaking of shared packages. Mar 21, 2023
@dlabaj dlabaj requested a review from jpuzz0 March 21, 2023 16:26
Copy link
Contributor

@wise-king-sullyman wise-king-sullyman left a comment

Choose a reason for hiding this comment

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

LGTM, didn't run into any of the issues I was running into previously.

@dlabaj
Copy link
Contributor Author

dlabaj commented Mar 23, 2023

@wise-king-sullyman Want to review this again. It now should generate the package.jsons for esm in the module directories at the root instead of the dist/esm directory.

@wise-king-sullyman wise-king-sullyman self-requested a review March 23, 2023 18:51
@wise-king-sullyman
Copy link
Contributor

Not quite sure what you mean, and I tried to run it locally but it seems like something is causing errors when build:fed:packages runs now

@dlabaj
Copy link
Contributor Author

dlabaj commented Mar 27, 2023

Not quite sure what you mean, and I tried to run it locally but it seems like something is causing errors when build:fed:packages runs now

They are in /components, /deprecated, /helper, etc for esm. For common JS they are still in dist/cjs.

@nicolethoen nicolethoen linked an issue Mar 29, 2023 that may be closed by this pull request
6 tasks
Copy link
Contributor

@wise-king-sullyman wise-king-sullyman left a comment

Choose a reason for hiding this comment

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

Few comments below, also as we discussed on slack I think the config files will need to be updated since the deprecated etc directories now just re-export components from dist.

dlabaj added 5 commits April 5, 2023 13:18
…port fed modules tree-shacking of shared packages.

feat(infrastructure): Added ability import components directly to support fed modules tree-shacking of shared packages.
@dlabaj dlabaj force-pushed the fed_module_updates branch from 2738815 to eead8ce Compare April 5, 2023 17:19
Copy link
Contributor

@wise-king-sullyman wise-king-sullyman left a comment

Choose a reason for hiding this comment

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

Everything looks good to me, though I'm still not positive on how to test that these new package files are actually having the impact that we want them to.

@tlabaj tlabaj merged commit 16c15bf into patternfly:v5 Apr 13, 2023
@patternfly-build
Copy link
Contributor

Your changes have been released in:

  • @patternfly/react-charts@7.0.0-alpha.18
  • @patternfly/react-code-editor@5.0.0-alpha.67
  • @patternfly/react-core@5.0.0-alpha.66
  • @patternfly/react-docs@6.0.0-alpha.73
  • demo-app-ts@5.0.0-alpha.50
  • @patternfly/react-table@5.0.0-alpha.68

Thanks for your contribution! 🎉

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.

Infrastructure - Update build to support direct imports

5 participants