Skip to content

revert: bring back Babel CJS transform#3798

Merged
bartlomieju merged 2 commits intomainfrom
revert/cjs-changes
Apr 28, 2026
Merged

revert: bring back Babel CJS transform#3798
bartlomieju merged 2 commits intomainfrom
revert/cjs-changes

Conversation

@bartlomieju
Copy link
Copy Markdown
Member

Summary

Reverts two commits that broke CJS package handling in dev mode:

The simplified CJS shim introduced in #3767 has two fundamental issues:

  1. Detection: the heuristic (code.includes("export ")) is fooled by comments containing "export"
  2. Named exports: the shim only provides export default module.exports, so import { trace } from "@opentelemetry/api" returns undefined (Cannot read properties of undefined (reading 'getTracer') #3797)

The Babel-based transform handled both correctly. Bringing it back until we can replace it with a proper solution using deno_ast's CJS parser.

Test plan

  • All 38 dev server tests pass
  • All 33 build tests pass

@bartlomieju bartlomieju merged commit 8c14866 into main Apr 28, 2026
8 of 9 checks passed
@bartlomieju bartlomieju deleted the revert/cjs-changes branch April 28, 2026 11:20
bartlomieju added a commit that referenced this pull request Apr 28, 2026
## Summary

- Bump `@fresh/core` 2.3.2 → 2.3.3
- Bump `@fresh/plugin-vite` 1.1.1 → 1.1.2
- Bump `@fresh/init` 2.3.2 → 2.3.3
- Bump `@fresh/update` 2.3.2 → 2.3.3

Reverts the broken CJS shim (#3798) and releases the restored Babel CJS
transform.
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.

1 participant