-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Closed
Labels
Description
Reproduction
Requires: Volta or manually running this with node 20.18.2
- Clone https://github.com/andreiborza/ab-rr-node-20-18-2
- run
pnpm install - run
pnpm build
System Info
System:
OS: macOS 15.5
CPU: (12) arm64 Apple M3 Pro
Memory: 1.33 GB / 36.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.18.2 - <redcated>/.volta/tools/image/node/20.18.2/bin/node
Yarn: 1.22.22 - <redcated>/.volta/tools/image/yarn/1.22.22/bin/yarn
npm: 10.8.2 - <redcated>/.volta/tools/image/node/20.18.2/bin/npm
pnpm: 9.15.9 - <redcated>/.volta/bin/pnpm
bun: 1.3.1 - <redcated>/.bun/bin/bun
Deno: 2.1.6 - <redcated>/.deno/bin/deno
Watchman: 2024.12.02.00 - /opt/homebrew/bin/watchman
Browsers:
Chrome: 143.0.7499.41
Firefox: 145.0.2
Safari: 18.5
npmPackages:
@react-router/dev: ^7.9.2 => 7.10.0
@react-router/node: ^7.9.2 => 7.10.0
@react-router/serve: ^7.9.2 => 7.10.0
react-router: ^7.9.2 => 7.10.0
vite: ^7.1.7 => 7.2.6Used Package Manager
pnpm
Expected Behavior
Project builds correctly.
Actual Behavior
> my-react-router-app@ build <redacted>/ab-rr-node-20-18-2
> react-router build
node:internal/modules/cjs/loader:1309
throw new ERR_REQUIRE_ESM(filename, true);
^
Error [ERR_REQUIRE_ESM]: require() of ES Module <redacted>/ab-rr-node-20-18-2/node_modules/.pnpm/pkg-types@2.3.0/node_modules/pkg-types/dist/index.mjs not supported.
Instead change the require of <redacted>/ab-rr-node-20-18-2/node_modules/.pnpm/pkg-types@2.3.0/node_modules/pkg-types/dist/index.mjs to a dynamic import() which is available in all CommonJS modules.
at TracingChannel.traceSync (node:diagnostics_channel:315:14)
at Object.<anonymous> (<redacted>/ab-rr-node-20-18-2/node_modules/.pnpm/@react-router+dev@7.10.0_@react-router+serve@7.10.0_react-router@7.10.0_react-dom@19.2.0_reac_dd6zxms4crew7mlwvsm2nood3y/node_modules/@react-router/dev/dist/cli/index.js:2158:25) {
code: 'ERR_REQUIRE_ESM'
}
Seems related to https://app.unpkg.com/@react-router/dev@7.10.0/files/dist/cli/index.js#L742 not being wrapped with _toESM in the build output.
chargome, carlosgma and AbhiPrasad