Repository navigation
feat: one import path per public component, for Turbopack builds (3.0) - #358
Merged
lorant-one merged 3 commits intoOct 30, 2026
Merged
Conversation
Next 16 builds with Turbopack, which ignores optimizePackageImports, so a server component importing Button from the package root ships every client component (measured: ~150 KB gzip of Once UI on a page with a Button and four layout components). @once-ui-system/core/components/<Name> imports one file; the same page drops to ~26 KB. Root imports unchanged. From the Graphite migration report. Docs quick start and AGENTS.md say when to use it; a test keeps each component file exporting its name. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016gNJtvihFgt8bSFzr13Wsn
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
16 tasks
Member
Author
|
"Build, typecheck and test" is failing in I'm not changing the contract test until the owner decides between three options:
The Turbopack measurement in the description holds whichever option is chosen. Generated by Claude Code |
3.0 dropped the ./components/* wildcard because it made internal modules public, and package-exports.test.ts enforces that. List an entry per module the root barrel re-exports whole instead (86), generated by scripts/sync-component-exports.mjs, so no context or shared style is importable. The codemod keeps a deep import of a public component on its own path (dropping .js) rather than moving it to the root, and still moves internals and removed components. MIGRATING §12 and the CHANGELOG say so. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016gNJtvihFgt8bSFzr13Wsn
…feat/component-subpath-exports
This was referenced Oct 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Lorant · project thread
This addresses the P0 from the Graphite migration report: on Next 16, Turbopack shipped the whole library to a page that used only a few components.
Owner decision pending: this adds an entry point to the 3.0 exports contract (MIGRATING §12). The approach below is the one I recommended.
Measured on this branch
Each figure is a Next 16.2.12 static export of one page with
Column,Row,HeadingandText, plus oneButton. The number is the gzip JS thatindex.htmlloads; the framework alone is about 191 kB.optimizePackageImportsoptimizePackageImportsSetting
sideEffectsto only./dist/css/*.cssmade no difference under Turbopack. The cause is the server compile collecting client references through the barrel.Changes
exportslists./components/<Name>one by one for the 86 modules the root barrel re-exports whole. It is not the 2.x wildcard, so internal modules (FormContext, ScrollLock's helpers…) stay private, as 3.0 intends.scripts/sync-component-exports.mjsgenerates the list;--checkreports drift.component-subpaths.test.tschecks that the entries equal the barrel's modules exactly.package-exports.test.tsstill forbids the wildcard and internal paths..js. It still moves internal modules and removed components (such asModal) to the root.AGENTS.md, MIGRATING §12 and the CHANGELOG.Checks
vitest runpasses 3896/3896,tsc --noEmitis clean, andlint:gateis at baseline.check:packagepasses.Not here
🤖 Generated with Claude Code
https://claude.ai/code/session_016gNJtvihFgt8bSFzr13Wsn