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

Generate "type": "module" npm packages when ESM is enabled #131

Merged
merged 5 commits into from
Jun 9, 2023
Merged

Conversation

nex3
Copy link
Collaborator

@nex3 nex3 commented Jun 8, 2023

@nex3 nex3 requested a review from Goodwine June 8, 2023 21:58
nex3 added 2 commits June 8, 2023 16:47
This now uses a complex scheme for file extensions to route around the
various constraints, as documented in npm.dart.
@nex3 nex3 merged commit 8696537 into main Jun 9, 2023
@nex3 nex3 deleted the type-module branch June 9, 2023 01:24
@webketje
Copy link

webketje commented Jun 9, 2023

@nex3 Does this fix also address the second issue I mentioned in sass/dart-sass#1995 (comment)? (else it will fail with ReferenceError: require is not defined instead of SyntaxError: Cannot use import statement outside a module)

@nex3
Copy link
Collaborator Author

nex3 commented Jun 9, 2023

Yes. The PR title here is misleading (I forgot to change it 😅), but this doesn't mark the package as "type": "module". We decided that instead, we needed to make it treat files as CJS by default, so we explicitly mark ESM files on Node as .mjs.

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

Successfully merging this pull request may close these issues.

3 participants