-
Notifications
You must be signed in to change notification settings - Fork 45
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
feat: support tree shaking #829
base: main
Are you sure you want to change the base?
Conversation
Need to bump node in .codesanbox dir |
@gclark-eightfold You may be correct: |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #829 +/- ##
=======================================
Coverage 84.69% 84.70%
=======================================
Files 1098 1098
Lines 20417 20417
Branches 7718 7718
=======================================
+ Hits 17293 17294 +1
+ Misses 3040 3039 -1
Partials 84 84 ☔ View full report in Codecov by Sentry. |
Also removed this line and its import to fix the circular dep issue accross bundles: https://github.com/EightfoldAI/octuple/blob/main/src/shared/utilities/flexGapSupported.ts#L7 |
SUMMARY:
Adds tree-shaking support for apps using Octuple. Core changes:
sideEffects
topackage.json
for CJS tree shaking.For the Webpack -> Rollup change, it may be possible to export ESM from webpack, but most sources I found said exporting ESM from webpack was not supported. Additionally, after examining quite a number of specifically react component libraries, it seemed like Rollup was the most common tool for this job.
Here is the bundle analysis diff in Blindfold.ai after following the steps outlined in the Test Plan
Before
After
GITHUB ISSUE (Open Source Contributors)
NA
JIRA TASK (Eightfold Employees Only):
ENG-55139
CHANGE TYPE:
TEST COVERAGE:
TEST PLAN:
.env
file. (If you have one already, just addANALYZE_BUNDLES=1
git checkout gclark/octuple-bundle-test
to pull these changes.pnpm install
. (Runnpm install -g pnpm
if you do not have pnpm installed)pnpm build --filter nextjs
to build the Blindfold app.apps/nextjs/.next/analyze/client.html
in your web browser.octuple.js
bundle present.pnpm start --filter nextjs
and go to http://localhost:8000/octuplepnpm patch-remove @eightfold.ai/octuple
pnpm build --filter nextjs
again.apps/nextjs/.next/analyze/client.html
in your web browser.octuple.js
bundle present.