Skip to content
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

package.json missing type: module #1156

Closed
unional opened this issue Nov 3, 2022 · 4 comments
Closed

package.json missing type: module #1156

unional opened this issue Nov 3, 2022 · 4 comments

Comments

@unional
Copy link

unional commented Nov 3, 2022

This is needed for nodejs: https://nodejs.org/api/packages.html
Because of that, I think the exports: {...} does not do what it wanted to do at the moment.

@RReverser
Copy link
Member

No, type: module is for overriding JS extensions to mean ES modules. exports should work regardless.

What do you mean by "does not do what it wanted to do" - if it doesn't work for you, can you please provide some sample code, what error you're getting and the expected behaviour?

@RReverser
Copy link
Member

Here is a very quick test showing that importing does work:

import { version } from "acorn";
console.log(version);
> node index.mjs
8.8.1

@unional
Copy link
Author

unional commented Nov 3, 2022

ar, yes, you are correct. Because you are doing exports: { import: "./dist/acron.mjs" },

so type: module is optional.

I missed that and though it falls under this issue: microsoft/TypeScript#49083 (comment)

thanks!

@unional unional closed this as completed Nov 3, 2022
@Musti331

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants