Any `--import` flag in NODE_OPTIONS makes Node.js run the main entry
point through the ESM loader, on every Node.js version. The ESM loader
rejects extensions that only CommonJS require hooks handle, so
`ts-node index.ts` failed with ERR_UNKNOWN_FILE_EXTENSION once the
global virtual store injected its NODE_PATH loader flag. Node.js 24+
only appeared unaffected because it strips TypeScript types natively.
The resolve hook now marks an entry point that the ESM loader cannot
classify as CommonJS, which hands it back to the CommonJS loader, as
Node.js does without `--import`. `.js` entry points and entry points
without an extension are left alone because Node.js may detect module
syntax in them. The hook stays resolve-only: registering any synchronous
load hook breaks require.extensions for CommonJS mains on Node.js 22.15.
The hook is now installed even when NODE_PATH is empty, since the flag
alone already routes the entry point through the ESM loader.
Closespnpm/pnpm#16436