Skip to content

Conversation

jeffsee55
Copy link
Contributor

@jeffsee55 jeffsee55 commented Aug 7, 2025

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

Copy link

changeset-bot bot commented Aug 7, 2025

🦋 Changeset detected

Latest commit: 8c6d451

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

This PR includes changesets to release 4 packages
Name Type
@vercel/hono Patch
@vercel/node Patch
vercel Patch
@vercel/express 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

@jeffsee55 jeffsee55 changed the title Always compile .mts to ESM node-builder: Always compile .mts to ESM Aug 7, 2025
@jeffsee55 jeffsee55 marked this pull request as ready for review August 8, 2025 18:24
@jeffsee55 jeffsee55 requested review from Kikobeats and a team as code owners August 8, 2025 18:24
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>
Copy link
Contributor

@vercel vercel bot left a 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.

@jeffsee55 jeffsee55 merged commit fea94ee into main Sep 2, 2025
297 of 300 checks passed
@jeffsee55 jeffsee55 deleted the jeffsee/flow-4690-fix-issue-where-ts-files-with-no-tsconfig-are-always-3 branch September 2, 2025 21:34
jeffsee55 pushed a commit that referenced this pull request Sep 2, 2025
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>
Dargon789 pushed a commit to Dargon789/vercel that referenced this pull request Sep 3, 2025
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>
Dargon789 added a commit to Dargon789/vercel that referenced this pull request Sep 3, 2025
* 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>
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