diff --git a/dev-packages/browser-integration-tests/tsconfig.json b/dev-packages/browser-integration-tests/tsconfig.json index 05605881f5d6..5c906f72df9d 100644 --- a/dev-packages/browser-integration-tests/tsconfig.json +++ b/dev-packages/browser-integration-tests/tsconfig.json @@ -3,7 +3,6 @@ "compilerOptions": { "lib": ["dom", "ES2020"], - "moduleResolution": "node", "noEmit": true, "strict": true, "allowSyntheticDefaultImports": true, diff --git a/dev-packages/node-core-integration-tests/scripts/use-ts-3_8.js b/dev-packages/node-core-integration-tests/scripts/use-ts-3_8.js index d759179f8e06..d7603dabbdd9 100644 --- a/dev-packages/node-core-integration-tests/scripts/use-ts-3_8.js +++ b/dev-packages/node-core-integration-tests/scripts/use-ts-3_8.js @@ -36,4 +36,11 @@ const tsConfig = require(baseTscConfigPath); // TS 3.8 fails build when it encounters a config option it does not understand, so we remove it :( delete tsConfig.compilerOptions.noUncheckedIndexedAccess; +// TS 3.8 predates `node16` module/moduleResolution (added in TS 4.7). Restore the pre-`node16` +// base shape: drop `module` (so ts-node, which runs the scenarios, keeps emitting CommonJS) and +// use plain `node` resolution. Setting `module` to an ESM value here breaks the `ts-node/register` +// scenarios, which are loaded as CommonJS. +delete tsConfig.compilerOptions.module; +tsConfig.compilerOptions.moduleResolution = 'node'; + writeFileSync(baseTscConfigPath, JSON.stringify(tsConfig, null, 2)); diff --git a/dev-packages/node-integration-tests/scripts/use-ts-3_8.js b/dev-packages/node-integration-tests/scripts/use-ts-3_8.js index d759179f8e06..d7603dabbdd9 100644 --- a/dev-packages/node-integration-tests/scripts/use-ts-3_8.js +++ b/dev-packages/node-integration-tests/scripts/use-ts-3_8.js @@ -36,4 +36,11 @@ const tsConfig = require(baseTscConfigPath); // TS 3.8 fails build when it encounters a config option it does not understand, so we remove it :( delete tsConfig.compilerOptions.noUncheckedIndexedAccess; +// TS 3.8 predates `node16` module/moduleResolution (added in TS 4.7). Restore the pre-`node16` +// base shape: drop `module` (so ts-node, which runs the scenarios, keeps emitting CommonJS) and +// use plain `node` resolution. Setting `module` to an ESM value here breaks the `ts-node/register` +// scenarios, which are loaded as CommonJS. +delete tsConfig.compilerOptions.module; +tsConfig.compilerOptions.moduleResolution = 'node'; + writeFileSync(baseTscConfigPath, JSON.stringify(tsConfig, null, 2)); diff --git a/dev-packages/test-utils/tsconfig.json b/dev-packages/test-utils/tsconfig.json index 9aac5ca8f289..f80703d3bca0 100644 --- a/dev-packages/test-utils/tsconfig.json +++ b/dev-packages/test-utils/tsconfig.json @@ -2,7 +2,6 @@ "extends": "../../tsconfig.json", "compilerOptions": { "target": "ES2022", - "module": "ES2022", // package-specific options "esModuleInterop": true }, diff --git a/nx.json b/nx.json index 656f381d9b43..d869745b42ee 100644 --- a/nx.json +++ b/nx.json @@ -5,7 +5,8 @@ "{workspaceRoot}/*.js", "{workspaceRoot}/*.json", "{workspaceRoot}/yarn.lock", - "{workspaceRoot}/dev-packages/rollup-utils/**" + "{workspaceRoot}/dev-packages/rollup-utils/**", + "{workspaceRoot}/packages/typescript/**" ], "production": ["default", "!{projectRoot}/test/**/*", "!{projectRoot}/**/*.md", "!{projectRoot}/*.tgz"] }, diff --git a/packages/angular/tsconfig.json b/packages/angular/tsconfig.json index 0d4d9607991a..777ea3d64aa1 100644 --- a/packages/angular/tsconfig.json +++ b/packages/angular/tsconfig.json @@ -1,12 +1,35 @@ { - "extends": "../../tsconfig.json", - + // NOTE: Unlike every other package, this config does NOT extend the shared base config + // (`../../tsconfig.json`). `@sentry/angular` is built with `ng-packagr`, which pins an older + // TypeScript (4.6) that doesn't understand the `node16` module/moduleResolution our base config + // defaults to (and rejects the literal even when overridden). We therefore inline the relevant + // base compiler options here and use `esnext`/`node` instead. "include": ["**/*.ts", "src/**/*"], "exclude": ["patch-vitest.ts", "setup-test.ts"], "compilerOptions": { - // package-specific options + "declaration": false, + "declarationMap": false, + "downlevelIteration": true, + "importHelpers": true, + "inlineSources": true, + "isolatedModules": true, + "lib": ["es2020"], + "module": "esnext", + "moduleResolution": "node", + "noErrorTruncation": true, + "noFallthroughCasesInSwitch": true, + "noImplicitReturns": true, + "noUnusedLocals": false, + "noUnusedParameters": false, + "preserveWatchOutput": true, + "sourceMap": true, + "strict": true, + "strictBindCallApply": false, + "target": "es2020", + "noUncheckedIndexedAccess": true, + "skipLibCheck": true, "experimentalDecorators": true } } diff --git a/packages/astro/tsconfig.json b/packages/astro/tsconfig.json index d1a9c722679f..bf45a09f2d71 100644 --- a/packages/astro/tsconfig.json +++ b/packages/astro/tsconfig.json @@ -4,7 +4,6 @@ "include": ["src/**/*"], "compilerOptions": { - "moduleResolution": "bundler" // package-specific options } } diff --git a/packages/browser/tsconfig.json b/packages/browser/tsconfig.json index 8efb233764b7..b80e9ddbfaa5 100644 --- a/packages/browser/tsconfig.json +++ b/packages/browser/tsconfig.json @@ -4,7 +4,6 @@ "include": ["src/**/*", "test/loader.js"], "compilerOptions": { - "moduleResolution": "bundler", "lib": ["DOM", "es2020", "WebWorker"] } } diff --git a/packages/cloudflare/tsconfig.json b/packages/cloudflare/tsconfig.json index ff89f0feaa23..4c46d500eead 100644 --- a/packages/cloudflare/tsconfig.json +++ b/packages/cloudflare/tsconfig.json @@ -4,7 +4,6 @@ "include": ["src/**/*"], "compilerOptions": { - "module": "esnext", "types": ["node", "@cloudflare/workers-types"] } } diff --git a/packages/core/tsconfig.types.json b/packages/core/tsconfig.types.json index de9b6935694a..65455f66bd75 100644 --- a/packages/core/tsconfig.types.json +++ b/packages/core/tsconfig.types.json @@ -2,8 +2,6 @@ "extends": "./tsconfig.json", "compilerOptions": { - "module": "esnext", - "moduleResolution": "bundler", "declaration": true, "declarationMap": true, "emitDeclarationOnly": true, diff --git a/packages/deno/tsconfig.build.json b/packages/deno/tsconfig.build.json index 87025d5676c5..c24f0659524b 100644 --- a/packages/deno/tsconfig.build.json +++ b/packages/deno/tsconfig.build.json @@ -4,7 +4,6 @@ "compilerOptions": { "outDir": "build", "lib": ["esnext"], - "module": "esnext", "target": "esnext", "declaration": true, "declarationMap": false diff --git a/packages/deno/tsconfig.json b/packages/deno/tsconfig.json index fdd107c1ed78..1051fee686e1 100644 --- a/packages/deno/tsconfig.json +++ b/packages/deno/tsconfig.json @@ -3,7 +3,6 @@ "include": ["./lib.deno.d.ts", "src/**/*", "example.ts"], "compilerOptions": { "lib": ["esnext"], - "module": "esnext", "target": "esnext" } } diff --git a/packages/deno/tsconfig.test.json b/packages/deno/tsconfig.test.json index 548e94149758..1e7bdc859db5 100644 --- a/packages/deno/tsconfig.test.json +++ b/packages/deno/tsconfig.test.json @@ -3,7 +3,6 @@ "include": ["./lib.deno.d.ts", "test/**/*"], "compilerOptions": { "lib": ["esnext"], - "module": "esnext", "target": "esnext" } } diff --git a/packages/effect/tsconfig.json b/packages/effect/tsconfig.json index d49b053b37f8..3691d1bb14f6 100644 --- a/packages/effect/tsconfig.json +++ b/packages/effect/tsconfig.json @@ -1,8 +1,6 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "module": "esnext", - "moduleResolution": "bundler", "outDir": "build" }, "include": ["src/**/*"] diff --git a/packages/ember/tsconfig.json b/packages/ember/tsconfig.json index 04eae83278b0..1f9068f3ba4a 100644 --- a/packages/ember/tsconfig.json +++ b/packages/ember/tsconfig.json @@ -4,7 +4,6 @@ "target": "es2022", "lib": ["DOM", "ES2022"], "allowJs": true, - "moduleResolution": "bundler", "allowSyntheticDefaultImports": true, "alwaysStrict": true, "strictNullChecks": true, @@ -12,7 +11,6 @@ "noEmitOnError": false, "noEmit": true, "baseUrl": ".", - "module": "esnext", "experimentalDecorators": true, "paths": { "dummy/tests/*": ["tests/*"], diff --git a/packages/feedback/tsconfig.json b/packages/feedback/tsconfig.json index 50734351f40b..1c951f0ee68e 100644 --- a/packages/feedback/tsconfig.json +++ b/packages/feedback/tsconfig.json @@ -1,8 +1,6 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "module": "esnext", - /* Preact Config */ "jsx": "react-jsx", "jsxImportSource": "preact", diff --git a/packages/hono/tsconfig.json b/packages/hono/tsconfig.json index ff89f0feaa23..4c46d500eead 100644 --- a/packages/hono/tsconfig.json +++ b/packages/hono/tsconfig.json @@ -4,7 +4,6 @@ "include": ["src/**/*"], "compilerOptions": { - "module": "esnext", "types": ["node", "@cloudflare/workers-types"] } } diff --git a/packages/integration-shims/tsconfig.json b/packages/integration-shims/tsconfig.json index d1a9c722679f..bf45a09f2d71 100644 --- a/packages/integration-shims/tsconfig.json +++ b/packages/integration-shims/tsconfig.json @@ -4,7 +4,6 @@ "include": ["src/**/*"], "compilerOptions": { - "moduleResolution": "bundler" // package-specific options } } diff --git a/packages/nextjs/tsconfig.json b/packages/nextjs/tsconfig.json index 202590772b10..bf45a09f2d71 100644 --- a/packages/nextjs/tsconfig.json +++ b/packages/nextjs/tsconfig.json @@ -5,7 +5,5 @@ "compilerOptions": { // package-specific options - "module": "esnext", - "moduleResolution": "bundler" } } diff --git a/packages/nitro/tsconfig.json b/packages/nitro/tsconfig.json index 202590772b10..bf45a09f2d71 100644 --- a/packages/nitro/tsconfig.json +++ b/packages/nitro/tsconfig.json @@ -5,7 +5,5 @@ "compilerOptions": { // package-specific options - "module": "esnext", - "moduleResolution": "bundler" } } diff --git a/packages/node-core/tsconfig.json b/packages/node-core/tsconfig.json index 28abec410557..da581f3329ff 100644 --- a/packages/node-core/tsconfig.json +++ b/packages/node-core/tsconfig.json @@ -4,8 +4,6 @@ "include": ["src/**/*"], "compilerOptions": { - "lib": ["ES2020", "ES2021.WeakRef"], - "module": "Node16", - "moduleResolution": "Node16" + "lib": ["ES2020", "ES2021.WeakRef"] } } diff --git a/packages/node-native/tsconfig.json b/packages/node-native/tsconfig.json index b1109af19fdf..087d3bdf1f07 100644 --- a/packages/node-native/tsconfig.json +++ b/packages/node-native/tsconfig.json @@ -1,8 +1,6 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "module": "esnext", - "lib": ["es2020"], "outDir": "build", "types": ["node"] }, diff --git a/packages/node/tsconfig.json b/packages/node/tsconfig.json index d5f034ad1048..cbfffafe5ca1 100644 --- a/packages/node/tsconfig.json +++ b/packages/node/tsconfig.json @@ -1,11 +1,5 @@ { "extends": "../../tsconfig.json", - "include": ["src/**/*"], - - "compilerOptions": { - "lib": ["es2020"], - "module": "Node16", - "moduleResolution": "Node16" - } + "include": ["src/**/*"] } diff --git a/packages/nuxt/tsconfig.json b/packages/nuxt/tsconfig.json index 5766b891dd95..348a44427fdf 100644 --- a/packages/nuxt/tsconfig.json +++ b/packages/nuxt/tsconfig.json @@ -5,7 +5,5 @@ "compilerOptions": { // package-specific options - "module": "esnext", - "moduleResolution": "bundler" } } diff --git a/packages/profiling-node/tsconfig.json b/packages/profiling-node/tsconfig.json index b1109af19fdf..087d3bdf1f07 100644 --- a/packages/profiling-node/tsconfig.json +++ b/packages/profiling-node/tsconfig.json @@ -1,8 +1,6 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "module": "esnext", - "lib": ["es2020"], "outDir": "build", "types": ["node"] }, diff --git a/packages/react-router/test/server/wrapServerAction.test.ts b/packages/react-router/test/server/wrapServerAction.test.ts index 043d838aa90a..149b90d570c0 100644 --- a/packages/react-router/test/server/wrapServerAction.test.ts +++ b/packages/react-router/test/server/wrapServerAction.test.ts @@ -120,7 +120,6 @@ describe('wrapServerAction', () => { it('should skip span creation and warn when instrumentation API is used', async () => { // Reset modules to get a fresh copy with unset warning flag vi.resetModules(); - // @ts-expect-error - Dynamic import for module reset works at runtime but vitest's typecheck doesn't fully support it const { wrapServerAction: freshWrapServerAction } = await import('../../src/server/wrapServerAction'); // Set the global flag indicating instrumentation API is in use diff --git a/packages/react-router/test/server/wrapServerLoader.test.ts b/packages/react-router/test/server/wrapServerLoader.test.ts index 7dfb39bbed42..ce3be0f4319a 100644 --- a/packages/react-router/test/server/wrapServerLoader.test.ts +++ b/packages/react-router/test/server/wrapServerLoader.test.ts @@ -120,7 +120,6 @@ describe('wrapServerLoader', () => { it('should skip span creation and warn when instrumentation API is used', async () => { // Reset modules to get a fresh copy with unset warning flag vi.resetModules(); - // @ts-expect-error - Dynamic import for module reset works at runtime but vitest's typecheck doesn't fully support it const { wrapServerLoader: freshWrapServerLoader } = await import('../../src/server/wrapServerLoader'); // Set the global flag indicating instrumentation API is in use diff --git a/packages/react-router/tsconfig.json b/packages/react-router/tsconfig.json index aa2dc034c7c3..2845677dcc52 100644 --- a/packages/react-router/tsconfig.json +++ b/packages/react-router/tsconfig.json @@ -4,7 +4,6 @@ "include": ["src/**/*"], "compilerOptions": { - "moduleResolution": "bundler", "jsx": "react" } } diff --git a/packages/react/tsconfig.json b/packages/react/tsconfig.json index 1b28c0b04eb9..41ff3c42258e 100644 --- a/packages/react/tsconfig.json +++ b/packages/react/tsconfig.json @@ -5,8 +5,6 @@ "compilerOptions": { "lib": ["DOM", "es2020"], - "module": "esnext", - "moduleResolution": "bundler", // package-specific options "esModuleInterop": true, "jsx": "react" diff --git a/packages/remix/tsconfig.json b/packages/remix/tsconfig.json index a1752fde9b92..2845677dcc52 100644 --- a/packages/remix/tsconfig.json +++ b/packages/remix/tsconfig.json @@ -4,8 +4,6 @@ "include": ["src/**/*"], "compilerOptions": { - "jsx": "react", - "module": "esnext", - "moduleResolution": "bundler" + "jsx": "react" } } diff --git a/packages/replay-canvas/tsconfig.json b/packages/replay-canvas/tsconfig.json index 4f9aae5f3994..b9c0e3a032f4 100644 --- a/packages/replay-canvas/tsconfig.json +++ b/packages/replay-canvas/tsconfig.json @@ -1,8 +1,7 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "lib": ["DOM", "es2020"], - "module": "esnext" + "lib": ["DOM", "es2020"] }, "include": ["src/**/*.ts"] } diff --git a/packages/replay-internal/tsconfig.json b/packages/replay-internal/tsconfig.json index 4f9aae5f3994..b9c0e3a032f4 100644 --- a/packages/replay-internal/tsconfig.json +++ b/packages/replay-internal/tsconfig.json @@ -1,8 +1,7 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "lib": ["DOM", "es2020"], - "module": "esnext" + "lib": ["DOM", "es2020"] }, "include": ["src/**/*.ts"] } diff --git a/packages/replay-worker/tsconfig.json b/packages/replay-worker/tsconfig.json index 24cce469ccc3..bfa37b859232 100644 --- a/packages/replay-worker/tsconfig.json +++ b/packages/replay-worker/tsconfig.json @@ -1,7 +1,6 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "module": "esnext", "lib": ["webworker", "scripthost"], "esModuleInterop": true, "target": "es2020", diff --git a/packages/server-utils/tsconfig.json b/packages/server-utils/tsconfig.json index eaeff42ce731..cbfffafe5ca1 100644 --- a/packages/server-utils/tsconfig.json +++ b/packages/server-utils/tsconfig.json @@ -1,9 +1,5 @@ { "extends": "../../tsconfig.json", - "include": ["src/**/*"], - - "compilerOptions": { - "lib": ["ES2020"] - } + "include": ["src/**/*"] } diff --git a/packages/solid/tsconfig.json b/packages/solid/tsconfig.json index fd54f069790c..82699cfe5ab5 100644 --- a/packages/solid/tsconfig.json +++ b/packages/solid/tsconfig.json @@ -5,5 +5,8 @@ "compilerOptions": { "lib": ["DOM", "es2020"] + // This package imports ESM-only deps (`solid-js`); under `node16` resolution a CommonJS file + // can't `require` those (TS1479/TS1541). Like our other framework packages it's compiled via a + // bundler, so use `esnext`/`bundler` here instead of the `node16` default. } } diff --git a/packages/solidstart/tsconfig.json b/packages/solidstart/tsconfig.json index 78a97ddc222b..b0eb9ecb6476 100644 --- a/packages/solidstart/tsconfig.json +++ b/packages/solidstart/tsconfig.json @@ -3,8 +3,5 @@ "include": ["src/**/*"], - "compilerOptions": { - "module": "esnext", - "moduleResolution": "bundler" - } + "compilerOptions": {} } diff --git a/packages/svelte/tsconfig.json b/packages/svelte/tsconfig.json index fd54f069790c..58e948b84ed6 100644 --- a/packages/svelte/tsconfig.json +++ b/packages/svelte/tsconfig.json @@ -4,6 +4,11 @@ "include": ["src/**/*"], "compilerOptions": { - "lib": ["DOM", "es2020"] + "lib": ["DOM", "es2020"], + // We still support Svelte 3, which imports types from deep paths (e.g. `svelte/types/compiler/preprocess`) + // that aren't declared in Svelte's `exports` map. `node16` resolution honors that map and rejects them, + // so we keep the legacy `node` resolver here, which resolves them via filesystem lookup. + "module": "esnext", + "moduleResolution": "node" } } diff --git a/packages/sveltekit/tsconfig.json b/packages/sveltekit/tsconfig.json index 0b788fab5eae..bf45a09f2d71 100644 --- a/packages/sveltekit/tsconfig.json +++ b/packages/sveltekit/tsconfig.json @@ -4,8 +4,6 @@ "include": ["src/**/*"], "compilerOptions": { - "module": "esnext", - "moduleResolution": "bundler" // package-specific options } } diff --git a/packages/tanstackstart-react/tsconfig.json b/packages/tanstackstart-react/tsconfig.json index c0a6a184ec03..9399ef75ead6 100644 --- a/packages/tanstackstart-react/tsconfig.json +++ b/packages/tanstackstart-react/tsconfig.json @@ -1,8 +1,5 @@ { "extends": "../../tsconfig.json", "include": ["src/**/*"], - "compilerOptions": { - "module": "esnext", - "moduleResolution": "bundler" - } + "compilerOptions": {} } diff --git a/packages/tanstackstart/tsconfig.json b/packages/tanstackstart/tsconfig.json index 220ba3fa2b86..52d43eaaa9b9 100644 --- a/packages/tanstackstart/tsconfig.json +++ b/packages/tanstackstart/tsconfig.json @@ -1,9 +1,4 @@ { "extends": "../../tsconfig.json", - "include": ["src/**/*"], - "compilerOptions": { - "lib": ["es2020"], - "module": "Node16", - "moduleResolution": "Node16" - } + "include": ["src/**/*"] } diff --git a/packages/types/tsconfig.json b/packages/types/tsconfig.json index e712bc6f77a7..cbfffafe5ca1 100644 --- a/packages/types/tsconfig.json +++ b/packages/types/tsconfig.json @@ -1,9 +1,5 @@ { "extends": "../../tsconfig.json", - "include": ["src/**/*"], - - "compilerOptions": { - "lib": ["es2020"] - } + "include": ["src/**/*"] } diff --git a/packages/typescript/tsconfig.json b/packages/typescript/tsconfig.json index 2e70d1a0c493..ea2154904764 100644 --- a/packages/typescript/tsconfig.json +++ b/packages/typescript/tsconfig.json @@ -7,7 +7,8 @@ "inlineSources": true, "isolatedModules": true, "lib": ["es2020"], - "moduleResolution": "node", + "module": "esnext", + "moduleResolution": "bundler", "noErrorTruncation": true, "noFallthroughCasesInSwitch": true, "noImplicitReturns": true, diff --git a/packages/vue/tsconfig.json b/packages/vue/tsconfig.json index 9c9351f7b801..fd54f069790c 100644 --- a/packages/vue/tsconfig.json +++ b/packages/vue/tsconfig.json @@ -4,8 +4,6 @@ "include": ["src/**/*"], "compilerOptions": { - "module": "esnext", - "moduleResolution": "bundler", "lib": ["DOM", "es2020"] } }