feat(react-headless-components-preview): switch to subpaths exports#36036
feat(react-headless-components-preview): switch to subpaths exports#36036dmytrokirpa wants to merge 1 commit intomicrosoft:masterfrom
Conversation
📊 Bundle size report
Unchanged fixtures
|
|
Pull request demo site: URL |
Hotell
left a comment
There was a problem hiding this comment.
left some comments / questions. otherwise looks good ty
| "node": "./lib-commonjs/index.js", | ||
| "import": "./lib/index.js", | ||
| "require": "./lib-commonjs/index.js" | ||
| "./*": { |
There was a problem hiding this comment.
this is what I was pointing out with the suggestion to have src/public/*, if anyone adds something by "mistake" to src/* it's gonna be exposed as public api + accessible within monorepo for usage.
also it probably doesn't make sense to expose the index.ts for public as it doesn't exposes anything
There was a problem hiding this comment.
that's a valid point, but honestly, src/public/* isn't any better, it has the same problem. Lets go with explicit exports map defined in package.json, as it will allow us to keep the package structure as it is now, wdyt?
I've already updated the PR 😄
fe2d854 to
4460694
Compare
8c093ba to
5b472a7
Compare
5b472a7 to
06b9431
Compare
| const config = { | ||
| react: { | ||
| 17: { | ||
| runConfig: { 'type-check': { configPath: 'tsconfig.lib.json' } }, |
There was a problem hiding this comment.
needed for passing the "moduleResolution" : "bundler"
06b9431 to
1923afa
Compare
1923afa to
a3396e7
Compare

Summary
"./*"entry with an explicit export map — every subpath is individually enumerated inpackage.jsonto prevent accidental exposure of internal modules"./radio-group","./message-bar","./tab-list") following the same convention used across the rest of the Fluent UI v9 package namespace"."barrel export — consumers must import from the specific component subpathexportsmap, catching gaps at CI time@fluentui/react-headless-components-preview/radio-group, etc.)Why explicit over wildcard
A wildcard
"./*"passes through any path under the package root — including build artifacts, internal utilities, and anything else that happens to exist inlib/. Explicit entries make the public surface intentional and auditable.Why kebab-case subpath keys
Kebab-case is consistent with how the rest of the Fluent UI v9 ecosystem names things in package paths and aligns with common Node.js ecosystem conventions for subpath exports . Removing the barrel export encourages consumers to import only what they need, enabling better tree-shaking.
Export map