fix(e2e)!: load TypeScript with e2e's own oxc loader, so pnpm 11+ installs pass
Every new pnpm 11+ user's first pnpm install after pnpm dlx e2e init fails today:
Error: ERR_PNPM_IGNORED_BUILDS
× installing dependencies
╰─▶ Ignored build scripts: esbuild@0.28.2
e2e loaded TypeScript through tsx, tsx depends on esbuild, and esbuild has a postinstall. pnpm 11+ fails on any build script the project has not decided on. The root fix is that nothing e2e installs runs an install script. Replaces the closed #712, which edited pnpm-workspace.yaml instead.
What changed
tsxis gone fromdependencies. e2e loads TypeScript itself with synchronousmodule.registerHookshooks (packages/e2e/src/config/esm-hooks.ts), compiles withoxc-transform(config/typescript.ts), and reads tsconfig withget-tsconfig(config/tsconfig.ts). None of the new dependencies has an install script; platform binaries come asoptionalDependencies.- One policy (
config/compiled-files.ts): one extension table (lang,format, the extension an import writes) drives what is compiled, its module format, the./x.jsswap, and implied extensions..ts .mts .tsx .jsxrun as ES modules,.ctsas CommonJS. A project file compiles with the nearest tsconfig.json; TypeScript in an installed package compiles with defaults. - Resolution: an import written in a compiled file follows TypeScript (
./x.jsand./xtox.ts, a directory's package.jsonmainthen index, tsconfigpaths/baseUrlfor project files); a#import or package export whose target is missing (./x.js, or./xwith no extension) moves to the TypeScript file behind it, also when a lax resolver earlier in the chain returned the missing file. An import written in JavaScript gets plain Node resolution.require()specifiers are read as platform paths (C:\app\helperon Windows;config/specifiers.ts). loadreads source throughnextLoad, so other hooks in the chain still see the file.- The tsconfig.json is the nearest one, or the referenced project that includes the file when it is solution-style (
files: []+references, as Vite writes). One that cannot be read (anextendspackage not installed) is skipped with one warning per run (the runner hands the files it warned about to its workers, which warn only about others they reach). tsconfig and file lookups live in a view per module graph (e2e-graph): fresh for eache2e mcpsession's graph load, read once otherwise (collecting 50 files parses theextendschain once). Outside a graph, file lookups go to the disk each time, as Node's own resolution does. - Compiled CommonJS starts with
require = globalThis[Symbol.for("e2e.hooked-require.v1")](__filename);, arequirethe loader registers: therequireNode hands a CommonJS module an ES module imported skips resolve hooks before nodejs/node#62920 (24.18.0, 26.2.0; not in 22), and on every version once amodule.registerloader is in the chain (Yarn PnP, tsx in NODE_OPTIONS). Itsresolveruns the loader's resolve hook, sincerequire.resolveskips hooks before nodejs/node#62028 (24.15.0; not in 22). The statement joins the end of the last directive (found from oxc-parser's parse of the output), so the prologue and every mapped position stay put; with no directive it takes its own first line and the map gains one unmapped line. - oxc helpers (
usingon Node 22, legacy decorators) come from e2e's own@oxc-project/runtime: thefrom "..."/require("...")specifiers oxc reports inhelpersUsedare rewritten (oxc 0.152 has no option for it), so a project's own@oxc-project/runtimeimport is untouched. - oxc appends
export {};to CommonJS whose only imports were type-only, before any trailing comment; the loader finds it in oxc-parser's parse of the output and blanks it. Not reported upstream yet (crates/oxc_transformer/src/typescript/annotations.rs). - Syntax oxc passes through and Node cannot run is refused before compiling, with
file:line:coland the fix: auto-accessors (no oxc release lowers them), decorators withoutexperimentalDecorators, andimportdeclarations and valueexportdeclarations in.cts(export interface/type/declarepass, as tsc allows). The check parses only files whose text could hold them. - oxc and oxc-parser load on first compile, so
--versionand--helprun without the native binding; without it, a run fails withTYPESCRIPT_COMPILER_UNAVAILABLE(exit 3) naming the@oxc-transform/@oxc-parserbindings for the platform and npm/cli#4828; any other load failure gives its reason. - Another loader earlier in the chain: a CommonJS load result with no source (Yarn PnP) is read from disk, and an inline source map it left is composed with oxc's (
@jridgewell/remapping), sofile:linestill names the file on disk. - Workers from source
--importconfig/register.ts, which registers the hooks; it andesm-hooks.tsload under Node's own type stripping, so they stay erasable TypeScript. - Removed what existed only for tsx:
tsxUsesSyncHooksand its version table, the tsx namespace andtsx-namespaceURL tagging, theNODE_OPTIONSinspection, and the diagnose hint for tsx's?namespace=CommonJS dead end. Config and tests now share the runner's module instances; theglobalThisslots stay for a project that loads its own copy of e2e. - A test's source location is read off the stack text, now with
at async ...frames (a test file that awaits a helper declaring tests), and onlyfile:URLs are decoded (collect/registry.ts); main throws on a%in a file name and loses the location at a#.util.getCallSitesdrops async frames andError.prepareStackTracegets no call sites while source maps are on, so the text stays the source. - A type imported without
import typethat stays in the output (a decorated member's type underemitDecoratorMetadata, a re-exported type) fails at link time as before, but the error now names the importing line andimport type. - Breaking: Node floor is
^22.22.3 || >=24.8.0for every published package (was>=22.12.0), as an explicit release-range model ininternal/node-version.ts.registerHooksdoes not exist before 22.15, and before 22.22.3 / 24.8.0 a CommonJS file an ES module imported cannotrequire()an ES module the hooks load (nodejs/node#59679). The CLI refuses older versions naming the ones to upgrade to, and the Bun and Deno runtimes (Bun has noregisterHooks; Deno has it but cannot load oxc's addon from a hook);registerLoaderrefuses them too (NODE_UNSUPPORTED). No asyncmodule.registerfallback. - Guards:
pnpm check:install-scripts(inpnpm check) walks the installed tree of every published package and names the chain to anypreinstall/install/postinstallorbinding.gyp(on main:e2e > tsx@4.23.14 > esbuild@0.28.2). A newinstallCI job runsscripts/install-smoke.tswith pnpm 11 and 12: packse2e,@e2e-dev/web,@e2e-dev/mobile, installs them into a fresh project, installs again from the lockfile, runs a TypeScript test, and fails on a non-zero exit,ERR_PNPM_IGNORED_BUILDS, or a writtenpnpm-workspace.yaml(on main:pnpm installexits 1). - CI
pnpm testruns on 22, 24, 26 (check-latest) and the floors 22.22.3 and 24.8.0. Vitest externalizes the workspace packages'dist/so integration tests load them natively, through e2e's hooks.
flowchart LR
A["import / require"] --> W{written in a compiled file?}
W -- no --> N[Node resolution]
W -- "yes: ./x.js, ./x, ./dir, tsconfig alias" --> P[TypeScript file, from the graph's view]
W -- "yes: # import / package export" --> X[Node resolution, retried on the x.js to x.ts swap]
P --> N
N --> F["format from the extension table; e2e-graph query"]
X --> F
F --> L{load hook}
L -- "TypeScript, JSX" --> O["nextLoad source, oxc-transform, inline source map"]
L -- "JSON, no type attribute" --> J["nextLoad as json, export default JSON.parse"]
L -- else --> D[nextLoad]
Parity with tsx
Each row has a test: tests/integration/typescript-loader.test.ts runs the built CLI on a fixture with all of them, in an ESM package and in a package without "type": "module", with --workers 2; tests/unit/esm-hooks.test.ts and tests/unit/typescript.test.ts cover the rules one by one.
| Case | main (tsx) | this branch |
|---|---|---|
config + tests, "type": "module" | yes | yes |
config + tests, no "type" (Next.js-style CJS scope) | yes | yes |
.mts | yes | yes |
.cts with import type, import x = require(), export = | yes | yes |
.cts with ESM import statements | yes (esbuild converts) | no, see below |
.tsx and .jsx (tsconfig jsx/jsxFactory) | yes | yes |
enums, const enum, namespaces, parameter properties | yes | yes |
experimentalDecorators (+ emitDecoratorMetadata) | yes | yes |
| standard (TC39) decorators | yes (esbuild lowers) | refused with file:line:col, see below |
auto-accessors (accessor x = 1) | yes (esbuild lowers) | refused with file:line:col, see below |
.cts with export interface/type/declare and module.exports | yes | yes |
package exports/imports target without extension (./src/*) | yes | yes |
tsconfig extends package not installed | yes (ignored silently) | yes, one warning |
Yarn PnP (module.register loader in the chain), .cts | yes | yes (not on Node 24.8.0 to 24.11.0, see below) |
import type | yes | yes |
tsconfig paths + baseUrl | yes (cwd tsconfig, JS files too) | yes (nearest tsconfig, from TypeScript files) |
./x and ./x.js importing x.ts, directory index | yes (from JS files too) | yes, from TypeScript files; JavaScript gets Node resolution |
workspace package exporting .ts source | yes | yes |
# subpath imports, including one mapped to ./x.js with x.ts on disk | yes | yes |
.cts requiring a sibling .ts (extensionless, .cjs, tsconfig alias) and a decorator helper | yes | yes |
JSON with and without with { type: 'json' } | yes | yes |
| top-level await | yes | yes |
.cjs helper require()ing project TypeScript | Node type stripping | yes, through the hooks |
.cts with a hashbang, a header comment, and 'use strict'; stack line of a throw | yes | yes |
.ts written with module.exports, required by a .cjs file | Node type stripping | no, see below |
failure file:line:col and test source in report and failure text | fails.e2e.ts:7:19, test at 5:1 | identical |
test file named 50% off #1.e2e.ts | COLLECTION_ERROR: URI malformed (50%off), empty source file (#) | collects, 7:19 and 5:1 |
config re-load freshness (e2e-graph), tsconfig alias in the graph | yes | yes, plus tsconfig edits apply |
| workers | yes | yes |
e2e mcp, e2e explore | yes | yes (mcp-server.test.ts, explore.test.ts) |
| Windows paths | pathToFileURL/fileURLToPath only, no platform branches | same |
Behavior changes, all in docs/reference/config.mdx and the changeset:
- oxc does not turn ESM
importstatements intorequirecalls, so a.ctsfile usesimport x = require(). TypeScript'sverbatimModuleSyntaxand Node's own type stripping draw the same line. - oxc compiles only legacy decorators. Standard decorators without
experimentalDecorators, and auto-accessors, are refused with theirfile:line:coland the fix. - The CLI runs on Node.js only:
bun --bun e2eanddeno run npm:e2eexit 2 naming the fix. Bun and Deno still install it, andbunx e2eruns it on Node.js. - Yarn PnP with a
.ctsfile on Node.js 24.8.0 to 24.11.0: Node rejects the sourceless CommonJS result PnP's loader returns before e2e's hook sees it (fixed in 24.11.1). Documented indocs/reference/cli.mdx. - Every
.tsis an ES module, including one a.cjsfile requires; CommonJS TypeScript goes in.cts. - An import written in a JavaScript file resolves as Node resolves it (tsx also applied TypeScript's extension rules and tsconfig
pathsthere). - TypeScript in an installed package compiles without the project's tsconfig.json.
Verified
Ran it locally: yes
Fresh user, pnpm 12.6.0. Every published package packed (pnpm pack) and served from a local verdaccio per build (main on 4410, this branch on 4411; e2e and @e2e-dev/* never proxy to npmjs, everything else does), fresh /tmp dirs, fresh store, minimumReleaseAge 0 so a seconds-old local publish is not what pnpm writes a workspace file for, example test against a static site on 4420.
| step | main | this branch |
|---|---|---|
pnpm dlx e2e init --yes | exit 0 | exit 0 |
pnpm install | exit 1, ERR_PNPM_IGNORED_BUILDS (esbuild@0.28.2) | exit 0 |
pnpm install --frozen-lockfile | exit 1, ERR_PNPM_IGNORED_BUILDS | exit 0 |
pnpm-workspace.yaml | written by pnpm: allowBuilds: esbuild: set this to true or false | absent |
esbuild/tsx in pnpm-lock.yaml | 4 entries | 0 |
pnpm exec e2e run (example test) | 1 passed (pnpm linked the packages before failing) | 1 passed |
pnpm 12.9.0 on this branch: the same five steps, all exit 0, no pnpm-workspace.yaml.
npm 11.17 (npx e2e init --yes, npm install, npm ci, npx e2e run) and bun 1.4.2 (bunx e2e init --yes, bun install, bun install --frozen-lockfile, bunx e2e run) on this branch: every step exit 0, example test passes.
Node floor. The same three files on each version (hooks.mjs registers pass-through registerHooks, main.mjs imports req.cjs, which requires esm.mjs):
| Node | result |
|---|---|
| 22.12.0 | SyntaxError: The requested module 'node:module' does not provide an export named 'registerHooks' |
| 22.22.2, 24.7.0 (also 22.15, 22.18, 24.0, 24.5) | TypeError: Cannot read properties of undefined (reading 'exports') at node:internal/modules/esm/translators (cjsCache.get(job.url).exports) |
| 22.22.3, 24.8.0, 26.10.0 | answer 42 |
The e2e unit and integration suites pass on 22.22.3, 24.8.0, 24.17.0 (the compiled-CommonJS require path), and 24.19.0; the loader's own tests also on 24.11.0 and 26.3.0; the parity fixture through the built CLI (--workers 2, ESM and CJS scope) also on 26.10.0. On 24.7.0 the CLI stops with e2e requires Node.js 22.22.3 or newer on Node.js 22, or 24.8.0 or newer; this is Node.js 24.7.0. ....
Install smoke. node scripts/install-smoke.ts 11 and ... 12 on this branch: install, frozen install, and the TypeScript test all exit 0. On main, pnpm install exits 1.
Package managers. Every published package packed and served from a local verdaccio on 4411 (e2e and @e2e-dev/* never proxy to npmjs), main is e2e@0.16.0 from npmjs. A fresh /tmp project per row: init --yes through the manager's own runner for npm and pnpm, a copy of that npm-initialized project for the rest; then a TS-heavy fixture (tsconfig paths, a .cts that requires ./plain, a legacy decorator and an enum, JSX, a #shared/* import map naming ./shared/src/* with no extension); install, frozen install, the example test against a static site on 4420, and the fixture. Node 24.19.
| manager | main: install / frozen | main: example / fixture | branch: install / frozen | branch: example / fixture |
|---|---|---|---|---|
| npm 11.17 | ok / ok | pass / fail (Cannot find module './plain' from the .cts) | ok / ok | pass / pass |
npm --omit=optional | ok / ok | pass / fail (same) | ok / ok | TYPESCRIPT_COMPILER_UNAVAILABLE naming the darwin-arm64 oxc bindings and npm/cli#4828, exit 3; e2e --version works |
| npm, lockfile written for linux-x64 | ok / ok | pass / fail (same) | ok / ok | pass / pass |
| pnpm 10.34 | ok / ok | pass / fail (same) | ok / ok | pass / pass |
| pnpm 11.28 | ERR_PNPM_IGNORED_BUILDS / same | pass / fail (same) | ok / ok, no workspace file | pass / pass |
| pnpm 12.9 | ERR_PNPM_IGNORED_BUILDS / same | pass / fail (same) | ok / ok, no workspace file | pass / pass |
pnpm 12 workspace monorepo (tests import a workspace package, exports: {"./*": "./src/*"}) | ERR_PNPM_IGNORED_BUILDS / same | pass / pass | ok / ok | pass / pass |
| Yarn 1.22 | ok / ok | pass / fail (same) | ok / ok | pass / pass |
Yarn 4.18, nodeLinker: node-modules | ok / ok | pass / fail (same) | ok / ok | pass / pass |
| Yarn 4.18, Plug'n'Play | ok / ok | pass / fail (same) | ok / ok | pass / pass |
Bun 1.4.2 install, bunx e2e run (Node.js) | ok / ok | pass / fail (same) | ok / ok | pass / pass |
bun --bun e2e run (Bun runtime) | Cannot find package 'tsx:' | exit 2: e2e runs on Node.js: Bun 1.4.2 reports Node.js 26.3.0 but has no module.registerHooks ... | ||
Deno 2.9.4 install, deno run -A npm:e2e run | ok / ok | Loading unprepared module ...?tsx-namespace=e2e | ok / ok | exit 2: e2e runs on Node.js, not Deno 2.9.4: run the CLI with Node.js (npx e2e). |
Suites. testbed: 71 passed, 1 skipped. Web benchmark tests/: 91 passed. Web benchmark tests-agent/ with CI=1 --strict-cache and no model key: identical per-test verdicts and counters on main and this branch (26 replayed, 2 handed off, 6 missed, 2 model calls refused for the missing key), so the branch moves no replay key. Mobile benchmark left to CI. Every edge case from review has a repro in /tmp/edge-repros and a committed regression test.
Timings. Config load and collect in a fresh process per round (loadConfigModule + resolveConfig + collect from dist), alternating rounds against main, medians.
| project | build | config load ms | collect ms | CPU ms | tests |
|---|---|---|---|---|---|
| apps/testbed | main | 150 | 12 | 231 | 71 |
| apps/testbed | branch | 136 | 17 | 189 | 71 |
| apps/web-benchmark | main | 150 | 21 | 242 | 91 |
| apps/web-benchmark | branch | 140 | 25 | 200 | 91 |
Config load is 10 to 14 ms faster and CPU about 18% lower (no tsx registration, no esbuild service). Collect is 4 to 5 ms slower: the syntax check parses files whose text could hold a refused construct, and oxc-parser loads on first use.