Files
bun.sh/test/regression
Claude Bot d884d7b113 fix(bundler): use resolver module type for __toESM isNodeMode flag
The bundler was passing `isNodeMode=1` to `__toESM` for all files with
ESM syntax, but it should only do so for files in a true Node.js ESM
context (.mjs/.mts extension or "type": "module" in package.json).

This caused CJS modules using the `__esModule` + `exports.default`
pattern (common in TypeScript-compiled packages) to have their default
export double-wrapped when imported from a regular .js file using ESM
syntax.

The fix preserves the resolver-determined module type (based on file
extension and package.json "type" field) through the parse phase into
the linker, using it instead of the syntax-based `exports_kind` for the
`input_module_type` printer option.

Closes #26901

Co-Authored-By: Claude <noreply@anthropic.com>
2026-02-11 17:20:55 +00:00
..