From c3cee650b867b193f8ad432535e9f69fed7f4d72 Mon Sep 17 00:00:00 2001 From: Francesco Gringl-Novy Date: Fri, 12 Jun 2026 12:06:16 +0200 Subject: [PATCH] ref(nitro): Inherit base Vitest config so vendored `@sentry/conventions` loads on Node 18 `packages/nitro/vite.config.ts` overrode `test` wholesale, so it did not pick up the base config's `server.deps.inline` rule. Spread `...baseConfig.test` so nitro's tests transform the vendored `@sentry/conventions` ESM copy instead of `require()`-ing it (which fails on Node 18). Co-Authored-By: Claude Opus 4.8 (1M context) --- packages/nitro/vite.config.ts | 1 + packages/typescript/tsconfig.json | 5 ++++- vite/vite.config.ts | 10 ++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/nitro/vite.config.ts b/packages/nitro/vite.config.ts index 4c0db8cdc068..5f83f34483c3 100644 --- a/packages/nitro/vite.config.ts +++ b/packages/nitro/vite.config.ts @@ -3,6 +3,7 @@ import baseConfig from '../../vite/vite.config'; export default { ...baseConfig, test: { + ...baseConfig.test, typecheck: { enabled: true, tsconfig: './tsconfig.test.json', diff --git a/packages/typescript/tsconfig.json b/packages/typescript/tsconfig.json index 2e70d1a0c493..b30d3f8887db 100644 --- a/packages/typescript/tsconfig.json +++ b/packages/typescript/tsconfig.json @@ -18,6 +18,9 @@ "strict": true, "strictBindCallApply": false, "target": "es2020", - "noUncheckedIndexedAccess": true + "noUncheckedIndexedAccess": true, + "paths": { + "@sentry/conventions/attributes": ["../../node_modules/@sentry/conventions/dist/attributes"] + } } } diff --git a/vite/vite.config.ts b/vite/vite.config.ts index c603d95fe856..7c1e01a7e66d 100644 --- a/vite/vite.config.ts +++ b/vite/vite.config.ts @@ -5,6 +5,16 @@ export default defineConfig({ __DEBUG_BUILD__: true, }, test: { + server: { + deps: { + // `@sentry/conventions` is vendored into our build output (under `build/esm/node_modules/...`) + // as ESM `.js` files. Vitest externalizes anything under a `node_modules/` path and loads it via + // native `require`, which fails on Node 18 ("ES Module shipped in a CommonJS package") because + // Node <20.19 can't `require()` ESM. Inlining makes Vitest transform it instead, so it works on + // all supported Node versions. Production is unaffected (the package resolves via its exports map). + inline: [/@sentry[/\\]conventions/], + }, + }, coverage: { enabled: true, reportsDirectory: './coverage',