Backport: TypeScript v6 deprecations for baseUrl and moduleResolution#92130
Backport: TypeScript v6 deprecations for baseUrl and moduleResolution#92130
Conversation
TypeScript 6 treats `moduleResolution: "node"` as deprecated (`node10`) and can fail builds with `TS5107`. This update keeps Next.js tsconfig defaults compatible with modern TypeScript by preferring `moduleResolution: "bundler"` for modern module modes, while preserving `"node"` for `commonjs`/`amd` configs where `bundler` is invalid. Also updates the related tests/snapshots to match the new defaults.
## Summary - handle `compilerOptions.baseUrl` inherited via `extends` in TS6 config normalization - rewrite `paths` using the resolved base URL and remove `baseUrl` from parsed compiler options - keep existing behavior for direct `baseUrl` while avoiding TS5101 in typecheck follow-up to #91847 ## Validation - `IS_WEBPACK_TEST=1 NEXT_TEST_MODE=start NEXT_TEST_REACT_VERSION=18.3.1 __NEXT_EXPERIMENTAL_STRICT_ROUTE_TYPES=true pnpm testheadless test/e2e/app-dir/next-config-ts/tsconfig-extends/next-config-ts-tsconfig-extends-esm.test.ts` - `IS_WEBPACK_TEST=1 NEXT_TEST_MODE=start NEXT_TEST_REACT_VERSION=18.3.1 __NEXT_EXPERIMENTAL_STRICT_ROUTE_TYPES=true pnpm testheadless test/e2e/app-dir/next-config-ts/import-alias-paths-with-baseurl/next-config-ts-import-alias-paths-with-baseurl-esm.test.ts`
Failing test suitesCommit: a2e5dd1 | About building and testing Next.js
Expand output● app dir - prefetching › should immediately render the loading state for a dynamic segment when fetched from higher up in the tree |
Stats from current PR🟢 1 improvement
📊 All Metrics📖 Metrics GlossaryDev Server Metrics:
Build Metrics:
Change Thresholds:
⚡ Dev Server
📦 Dev Server (Webpack) (Legacy)📦 Dev Server (Webpack)
⚡ Production Builds
📦 Production Builds (Webpack) (Legacy)📦 Production Builds (Webpack)
📦 Bundle SizesBundle Sizes⚡ TurbopackClient Main Bundles
Server Middleware
Build DetailsBuild Manifests
📦 WebpackClient Main Bundles
Polyfills
Pages
Server Edge SSR
Middleware
Build DetailsBuild Manifests
Build Cache
🔄 Shared (bundler-independent)Runtimes
📝 Changed Files (25 files)Files with changes:
View diffsapp-page-exp..ntime.dev.jsfailed to diffapp-page-exp..time.prod.jsfailed to diffapp-page-tur..ntime.dev.jsfailed to diffapp-page-tur..time.prod.jsfailed to diffapp-page-tur..ntime.dev.jsfailed to diffapp-page-tur..time.prod.jsfailed to diffapp-page.runtime.dev.jsfailed to diffapp-page.runtime.prod.jsfailed to diffapp-route-ex..ntime.dev.jsDiff too large to display app-route-ex..time.prod.jsDiff too large to display app-route-tu..ntime.dev.jsDiff too large to display app-route-tu..time.prod.jsDiff too large to display app-route-tu..ntime.dev.jsDiff too large to display app-route-tu..time.prod.jsDiff too large to display app-route.runtime.dev.jsDiff too large to display app-route.ru..time.prod.jsDiff too large to display pages-api-tu..ntime.dev.jsDiff too large to display pages-api-tu..time.prod.jsDiff too large to display pages-api.runtime.dev.jsDiff too large to display pages-api.ru..time.prod.jsDiff too large to display pages-turbo...ntime.dev.jsDiff too large to display pages-turbo...time.prod.jsDiff too large to display pages.runtime.dev.jsDiff too large to display pages.runtime.prod.jsDiff too large to display server.runtime.prod.jsDiff too large to display 📎 Tarball URL |
backports: #91855
backports: #91847