-
Notifications
You must be signed in to change notification settings - Fork 61
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
Add typeModule
experimental flag
#586
Conversation
🦋 Changeset detectedLatest commit: 715fa60 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #586 +/- ##
==========================================
+ Coverage 92.15% 92.38% +0.22%
==========================================
Files 39 39
Lines 1951 2049 +98
Branches 571 625 +54
==========================================
+ Hits 1798 1893 +95
- Misses 143 146 +3
Partials 10 10 ☔ View full report in Codecov by Sentry. |
9b80a45
to
4ad986f
Compare
|
||
> If you're just thinking "I want to write code with the native ECMAScript import and export syntax and have my code work for most people", you likely should not use this feature. This feature allows you to build packages that import Node.js ESM only dependencies and therefore only support being imported from ESM in newer versions of Node.js and some bundlers. | ||
|
||
The `type` config being set to `"module"` allows you to generate ECMAScript modules(ESM) compatible with Node.js' implementation of ESM (Node.js ESM), most modern bundlers, etc. |
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.
shouldnt this mention typeModule
and not type
with a "module"
value?
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.
"type": "module"
has to be set as well, the typeModule
experimental flag is mentioned further down.
|
||
expect(await getFiles(dir, ["**/dist/**/*"])).toMatchInlineSnapshot(` | ||
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ dist/multiple-entrypoints-multiply.d.ts ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ | ||
export * from "../src/multiply"; |
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.
@emmatown I think this should use an explicit extension
For now the output used in
preconstruct dev
will only work directly in Node if you're using no non-standard syntax (and following Node's stricter module resolution) or you're using a bundler that will handle it, I'd like to add a loader and fix that in the future.Related: #471, #513