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

Tree-shakable ESM build #331

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

orangemug
Copy link

This is a WIP PR to make oak-components tree-shakable in webpack (and hence nextjs)

Using an example next app with contains just the following

<OakThemeProvider theme={oakDefaultTheme}>
  <OakPrimaryButton>hello</OakPrimaryButton>
</OakThemeProvider>

Before: ~314kb
Screenshot 2024-11-27 at 13 05 08

After: ~31kb
Screenshot 2024-11-27 at 12 53 56

So essentially it's now properly tree shaking the bundle. The most important lines are these two in rollups config

preserveModules: true,
preserveModulesRoot: "src",

Todo

  • Causes some error when added into OWA (find out why)
  • Test, test, test

@orangemug orangemug changed the title feat: tree-shakable ESM build Tree-shakable ESM build Nov 27, 2024
Copy link

netlify bot commented Nov 27, 2024

Deploy Preview for lively-meringue-8ebd43 failed. Why did it fail? →

Name Link
🔨 Latest commit ab5ee0b
🔍 Latest deploy log https://app.netlify.com/sites/lively-meringue-8ebd43/deploys/674719e639454a0008ca55bb

Copy link

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.

1 participant