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

Add typeModule experimental flag #586

Merged
merged 18 commits into from Jan 15, 2024
Merged

Add typeModule experimental flag #586

merged 18 commits into from Jan 15, 2024

Conversation

emmatown
Copy link
Member

@emmatown emmatown commented Jan 12, 2024

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

Copy link

changeset-bot bot commented Jan 12, 2024

🦋 Changeset detected

Latest commit: 715fa60

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@preconstruct/cli Patch

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

Copy link

codecov bot commented Jan 12, 2024

Codecov Report

Attention: 7 lines in your changes are missing coverage. Please review.

Comparison is base (1a2ee56) 92.15% compared to head (715fa60) 92.38%.

Files Patch % Lines
packages/cli/src/build/config.ts 62.50% 2 Missing and 1 partial ⚠️
packages/cli/src/package.ts 88.23% 2 Missing ⚠️
packages/cli/src/project.ts 50.00% 2 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

@emmatown emmatown force-pushed the type-module branch 5 times, most recently from 9b80a45 to 4ad986f Compare January 15, 2024 01:24
@emmatown emmatown enabled auto-merge (squash) January 15, 2024 02:07
@emmatown emmatown merged commit d8e9cea into main Jan 15, 2024
9 checks passed
@emmatown emmatown deleted the type-module branch January 15, 2024 02:31
@github-actions github-actions bot mentioned this pull request Jan 15, 2024

> 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.
Copy link
Member

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?

Copy link
Member Author

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.

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.

None yet

2 participants