Skip to content

bundler: lower import.meta to a per-file object in cjs and iife output - #38200

Closed
robobun wants to merge 5 commits into
mainfrom
farm/ec204287/import-meta-non-module-output
Closed

robobun wants to merge 5 commits into
mainfrom
farm/ec204287/import-meta-non-module-output

test: cover the import.meta.require fallback under --compile --bytecode

b762e7c
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Oct 16, 2026 in 24m 14s

Code review found 2 important issues

Found 15 candidates, confirmed 6. See review comments for details.

Details

Severity Count
🔴 Important 2
🟡 Nit 2
🟣 Pre-existing 2
Severity File:Line Issue
🔴 Important src/js_parser/fold.rs:828 Browser iife bundles now embed the build machine's absolute file paths and silently resolve 'new URL(x, import.meta.url)
🔴 Important src/js_parser/fold.rs:830 Anyone shipping a '--format=iife --target=browser' bundle now serves their build machine's absolute source paths to ever
🟡 Nit src/js_parser/visit/visit_expr.rs:0 Users bundling to cjs or non-bun iife with --minify-syntax who read import.meta through a folded string key get 'undefin
🟡 Nit src/js_parser/parse/parse_entry.rs:1505 Users bundling to cjs or non-bun iife whose files form an import cycle get 'TypeError: undefined is not an object (evalu
🟣 Pre-existing src/bundler/ParseTask.rs:0 Pre-existing: a '.sqlite' import ('with { type: "sqlite" }') still puts a literal 'import.meta.require(...)' into cjs/'-
🟣 Pre-existing test/bundler/bundler_compile.test.ts:175 Elysia and TypeBox users who build with '--compile --bytecode' get a binary whose 'createRequire(import.meta.url)' fallb