-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix: package types #202
fix: package types #202
Conversation
example/package.json
Outdated
@@ -8,10 +8,21 @@ | |||
"types": "./dist/types.d.mts", | |||
"default": "./dist/module.mjs" | |||
}, | |||
"./utils": "./dist/utils.mjs" | |||
"./utils": { | |||
"types": "./dist/utils.d.mts", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this needed? I think we can omit .mts
for subpaths that match the types and typescript will infer them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing typesVersions, Node10 complaining
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -10,8 +10,16 @@ | |||
}, | |||
"./utils": "./dist/utils.mjs" | |||
}, | |||
"main": "./dist/module.cjs", | |||
"types": "./dist/types.d.ts", | |||
"main": "dist/module.mjs", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think anything that has the capability of running ESM will pick exports
. What bug does this solve?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, if we use .cjs
Node10 will complain
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so, we need to move it to ESM-only or patch cjs with exports.default
instead module.exports
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to me like this is just patching an issue that will never occur (because modules are loaded in Nuxt with jiti, not native ESM) and modules have type: module
set anyway... 🤔
it might be time to remove the stub - cc: @pi0 who might have an idea whether it is still needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uhmmm, check these 3 for example, missing type module:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check also antfu-collective/vite-plugin-inspect#100 and the PR antfu-collective/vite-plugin-inspect#101
This PR includes:
./module.js
intypes.d.mts
generation