-
Notifications
You must be signed in to change notification settings - Fork 2.9k
node-builder: Always compile .mts
to ESM
#13693
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
node-builder: Always compile .mts
to ESM
#13693
Conversation
🦋 Changeset detectedLatest commit: 8c6d451 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
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 |
.mts
to ESM.mts
to ESM
…ith-no-tsconfig-are-always-3
Co-authored-by: Steven <steven@ceriously.com>
…flow-4690-fix-issue-where-ts-files-with-no-tsconfig-are-always-3
…nfig-are-always-3' of https://github.com/vercel/vercel into jeffsee/flow-4690-fix-issue-where-ts-files-with-no-tsconfig-are-always-3
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
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.
Additional Comments:
packages/hono/test/fixtures/13-index-mts-no-tsconfig-node-no-module (lines NaN-NaN):
The test fixture directory is incorrectly numbered as "13", but there's already a "13-app-js-no-module" fixture, creating a duplicate number in the test suite.
View Details
📝 Patch Details
diff --git a/packages/hono/test/fixtures/13-index-mts-no-tsconfig-node-no-module/.gitignore b/packages/hono/test/fixtures/14-index-mts-no-tsconfig-node-no-module/.gitignore
similarity index 100%
rename from packages/hono/test/fixtures/13-index-mts-no-tsconfig-node-no-module/.gitignore
rename to packages/hono/test/fixtures/14-index-mts-no-tsconfig-node-no-module/.gitignore
diff --git a/packages/hono/test/fixtures/13-index-mts-no-tsconfig-node-no-module/index.mts b/packages/hono/test/fixtures/14-index-mts-no-tsconfig-node-no-module/index.mts
similarity index 100%
rename from packages/hono/test/fixtures/13-index-mts-no-tsconfig-node-no-module/index.mts
rename to packages/hono/test/fixtures/14-index-mts-no-tsconfig-node-no-module/index.mts
diff --git a/packages/hono/test/fixtures/13-index-mts-no-tsconfig-node-no-module/package-lock.json b/packages/hono/test/fixtures/14-index-mts-no-tsconfig-node-no-module/package-lock.json
similarity index 94%
rename from packages/hono/test/fixtures/13-index-mts-no-tsconfig-node-no-module/package-lock.json
rename to packages/hono/test/fixtures/14-index-mts-no-tsconfig-node-no-module/package-lock.json
index d41a96ae4..00c97e9fb 100644
--- a/packages/hono/test/fixtures/13-index-mts-no-tsconfig-node-no-module/package-lock.json
+++ b/packages/hono/test/fixtures/14-index-mts-no-tsconfig-node-no-module/package-lock.json
@@ -1,5 +1,5 @@
{
- "name": "13-index-mts-no-tsconfig-node-no-module",
+ "name": "14-index-mts-no-tsconfig-node-no-module",
"lockfileVersion": 3,
"requires": true,
"packages": {
diff --git a/packages/hono/test/fixtures/13-index-mts-no-tsconfig-node-no-module/package.json b/packages/hono/test/fixtures/14-index-mts-no-tsconfig-node-no-module/package.json
similarity index 100%
rename from packages/hono/test/fixtures/13-index-mts-no-tsconfig-node-no-module/package.json
rename to packages/hono/test/fixtures/14-index-mts-no-tsconfig-node-no-module/package.json
diff --git a/packages/hono/test/unit/build.test.ts b/packages/hono/test/unit/build.test.ts
index e8ace8c2b..d37fa7a35 100644
--- a/packages/hono/test/unit/build.test.ts
+++ b/packages/hono/test/unit/build.test.ts
@@ -118,7 +118,7 @@ const fixtures = {
handler: ['index.mjs'],
moduleType: 'esm',
},
- '13-index-mts-no-tsconfig-node-no-module': {
+ '14-index-mts-no-tsconfig-node-no-module': {
handler: ['index.mjs'],
moduleType: 'esm',
},
Analysis
The new test fixture 13-index-mts-no-tsconfig-node-no-module
uses the same number "13" as the existing 13-app-js-no-module
fixture. This creates confusion and potential issues in test organization.
Looking at the test fixture numbering sequence, the next available number should be "14". The directory should be renamed to 14-index-mts-no-tsconfig-node-no-module
, and the corresponding test entry in packages/hono/test/unit/build.test.ts
should be updated from '13-index-mts-no-tsconfig-node-no-module'
to '14-index-mts-no-tsconfig-node-no-module'
.
This also affects the package-lock.json file in the fixture directory, which contains the directory name in its "name" field and should be updated accordingly.
…ith-no-tsconfig-are-always-3
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## vercel@47.0.1 ### Patch Changes - Updated dependencies \[[`17f3c91aa96ce272d265d809f3b765a12a1f38b3`](17f3c91), [`fea94eea32f9df7c72d9ea95434d84c44f4ef082`](fea94ee)]: - @vercel/next@4.12.4 - @vercel/hono@0.0.20 - @vercel/node@5.3.19 - @vercel/express@0.0.12 ## @vercel/express@0.0.12 ### Patch Changes - Updated dependencies \[[`fea94eea32f9df7c72d9ea95434d84c44f4ef082`](fea94ee)]: - @vercel/node@5.3.19 ## @vercel/hono@0.0.20 ### Patch Changes - Always compile `.mts` to ESM ([#13693](#13693)) - Updated dependencies \[[`fea94eea32f9df7c72d9ea95434d84c44f4ef082`](fea94ee)]: - @vercel/node@5.3.19 ## @vercel/next@4.12.4 ### Patch Changes - Skip adding rewrite headers when the destination has no rewritten pathname or query (and when external origin is not allowed). This prevents generating an empty `rewrite.headers` object that fails schema validation and restores previous behavior for external or no-op rewrites. ([#13844](#13844)) ## @vercel/node@5.3.19 ### Patch Changes - Always compile `.mts` to ESM ([#13693](#13693)) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## vercel@47.0.1 ### Patch Changes - Updated dependencies \[[`17f3c91aa96ce272d265d809f3b765a12a1f38b3`](vercel@17f3c91), [`fea94eea32f9df7c72d9ea95434d84c44f4ef082`](vercel@fea94ee)]: - @vercel/next@4.12.4 - @vercel/hono@0.0.20 - @vercel/node@5.3.19 - @vercel/express@0.0.12 ## @vercel/express@0.0.12 ### Patch Changes - Updated dependencies \[[`fea94eea32f9df7c72d9ea95434d84c44f4ef082`](vercel@fea94ee)]: - @vercel/node@5.3.19 ## @vercel/hono@0.0.20 ### Patch Changes - Always compile `.mts` to ESM ([vercel#13693](vercel#13693)) - Updated dependencies \[[`fea94eea32f9df7c72d9ea95434d84c44f4ef082`](vercel@fea94ee)]: - @vercel/node@5.3.19 ## @vercel/next@4.12.4 ### Patch Changes - Skip adding rewrite headers when the destination has no rewritten pathname or query (and when external origin is not allowed). This prevents generating an empty `rewrite.headers` object that fails schema validation and restores previous behavior for external or no-op rewrites. ([vercel#13844](vercel#13844)) ## @vercel/node@5.3.19 ### Patch Changes - Always compile `.mts` to ESM ([vercel#13693](vercel#13693)) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* Add .circleci/config.yml * Version Packages (vercel#13862) This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## vercel@47.0.1 ### Patch Changes - Updated dependencies \[[`17f3c91aa96ce272d265d809f3b765a12a1f38b3`](vercel@17f3c91), [`fea94eea32f9df7c72d9ea95434d84c44f4ef082`](vercel@fea94ee)]: - @vercel/next@4.12.4 - @vercel/hono@0.0.20 - @vercel/node@5.3.19 - @vercel/express@0.0.12 ## @vercel/express@0.0.12 ### Patch Changes - Updated dependencies \[[`fea94eea32f9df7c72d9ea95434d84c44f4ef082`](vercel@fea94ee)]: - @vercel/node@5.3.19 ## @vercel/hono@0.0.20 ### Patch Changes - Always compile `.mts` to ESM ([vercel#13693](vercel#13693)) - Updated dependencies \[[`fea94eea32f9df7c72d9ea95434d84c44f4ef082`](vercel@fea94ee)]: - @vercel/node@5.3.19 ## @vercel/next@4.12.4 ### Patch Changes - Skip adding rewrite headers when the destination has no rewritten pathname or query (and when external origin is not allowed). This prevents generating an empty `rewrite.headers` object that fails schema validation and restores previous behavior for external or no-op rewrites. ([vercel#13844](vercel#13844)) ## @vercel/node@5.3.19 ### Patch Changes - Always compile `.mts` to ESM ([vercel#13693](vercel#13693)) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: Vercel Release Bot <88769842+vercel-release-bot@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
When theres' no
tsconfig
& no"type": "module"
we should still compile to ESM. The previous PR was just for.ts
files, which may compile to CJS if there's no"type": "module"
, but for.mts
we should never do that.EDIT: this PR was dramatically simplified to just use nodenext when no
tsconfig.json
is found