Skip to content

Publish internal/babel as ESM, matching what it ships - #3586

Merged
DylanPiercey merged 1 commit into
mainfrom
dpiercey-fix-internal-babel-type
Jul 24, 2026
Merged

Publish internal/babel as ESM, matching what it ships#3586
DylanPiercey merged 1 commit into
mainfrom
dpiercey-fix-internal-babel-type

Conversation

@DylanPiercey

Copy link
Copy Markdown
Contributor

@marko/compiler@5.41.5 and 5.41.6 publish internal/babel/package.json with "type": "commonjs", which breaks tsc for consumers:

node_modules/@marko/compiler/internal/babel/index.ts(8,10):
error TS1295: ECMAScript imports and exports cannot be written in a CommonJS file
under 'verbatimModuleSyntax'.

That directory ships nothing executable — only index.ts, modules.d.ts and its package.json — and exports["./internal/babel"].types points straight at the ESM index.ts. The runtime entry resolves to dist/babel.js, which sits under the package root and takes its module type from there, so the CommonJS marker never governed it. The only thing that reads it is TypeScript, deciding the module kind of index.ts.

5.41.4 published no type field and was unaffected; the type:override was added alongside the native type-stripping work. Dropping it restores a correct "type": "module", matching the file it describes.

Verified: a simulated pkg-override publish ships "type": "module"; require("@marko/compiler/internal/babel") still resolves to dist/babel.js and returns the babel namespace; suite 9683 passing. Against a packed tarball the full marko-js/language-server build goes from failing to 0 TypeScript errors across all five packages — that repo's CI is currently red on 5.41.6 (marko-js/language-server#577).

`exports["./internal/babel"].types` points at `internal/babel/index.ts`,
and that directory ships nothing else executable — `index.ts`,
`modules.d.ts` and its `package.json`. The runtime entry resolves to
`dist/babel.js`, which sits under the package root and takes its module
type from there, so the CommonJS marker never governed it.

It did govern TypeScript, which reads the nearest `package.json` to
decide the module kind of `index.ts`. Declaring `commonjs` over an ESM
file makes every import in it an error under `verbatimModuleSyntax`:

  error TS1295: ECMAScript imports and exports cannot be written in a
  CommonJS file under 'verbatimModuleSyntax'

That takes out `tsc -b` for consumers such as marko-js/language-server.
5.41.4 published no `type` field and was unaffected; dropping the
override restores a correct `"type": "module"`.
@changeset-bot

changeset-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a56b418

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

This PR includes changesets to release 1 package
Name Type
@marko/compiler 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

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 30 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: feecb9be-d584-4cba-b0fb-d7fae6e2433c

📥 Commits

Reviewing files that changed from the base of the PR and between 3459bed and a56b418.

📒 Files selected for processing (2)
  • .changeset/internal-babel-module-type.md
  • packages/compiler/internal/babel/package.json
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dpiercey-fix-internal-babel-type

Comment @coderabbitai help to get the list of available commands.

@DylanPiercey
DylanPiercey merged commit 8f38f88 into main Jul 24, 2026
9 checks passed
@DylanPiercey
DylanPiercey deleted the dpiercey-fix-internal-babel-type branch July 24, 2026 22:52
@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.70%. Comparing base (3459bed) to head (a56b418).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3586   +/-   ##
=======================================
  Coverage   94.70%   94.70%           
=======================================
  Files         420      420           
  Lines       54737    54737           
  Branches     4585     4585           
=======================================
  Hits        51841    51841           
  Misses       2861     2861           
  Partials       35       35           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions Bot mentioned this pull request Jul 24, 2026
@DylanPiercey DylanPiercey moved this to Done in Roadmap Jul 31, 2026
@DylanPiercey DylanPiercey self-assigned this Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant