-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Bug: exports map point to invalid declarations types which may cause issues for ESM native users #25034
Comments
Even with So while typescript will allow an import like
|
This wont happen with |
Library
React Components / v9 (@fluentui/react-components)
Describe the issue
We introduced exports maps to our packages some time ago to improve bundling and tree-shakeability.
While doing that we forgot to update
types
fields within export maps, which currently point to non existing declaration files. This might be potentially dangerous to users that wanna use native ESM and use Typescript >=4.7 with"moduleResolution": "Node16",
or"moduleResolution": "NodeNext"
configuration.Have you discussed this feature with our team
v-build
Additional context
Exports map with types field paths are consumed by TS if and only if:
What does this mean to us:
typings
ortypes
root property in package.json that points to our rolluped file (dist/index.d.ts
ordist/unstable.d.ts
for unstable)"exports[glob]types"
in package json to point to./dist/index.d.ts
and./dist/unstable.d.ts
respectively.foo/hello.js
will try to resolvefoo/hello.d.ts
which will throw type error.🚨 Word of caution:
if consumers are using native ESM modules they are out of luck because v9 doesn't support native ESM modules -> Thus they should not use `compilerOptions.moduleResolution is set to Node16 or NodeNextat all !
Validations
Tasks
@fluentui/react-components
| will be closed by fix: create valid export maps #25558, Defined standard for v9 package file organization #24129The text was updated successfully, but these errors were encountered: