Skip to content

Commit 1faf032

Browse files
authored
feat: Turbopack typed links (#81528)
# Typed Links: Turbopack support This PR replaces the old `experimental.typedRoutes` implementation with a new approach that works on both Turbopack and Webpack. _Note: a previous version of this PR contained new props for the `Link` component: `path`, `params`, and `searchParams`. In the interest of bringing typed links support to Turbopack as soon as possible, I've removed that change from this PR and will create a new one later._
1 parent a466104 commit 1faf032

File tree

14 files changed

+520
-470
lines changed

14 files changed

+520
-470
lines changed

packages/next/src/build/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1316,7 +1316,11 @@ export default async function build(
13161316
rewrites: config.rewrites,
13171317
})
13181318

1319-
await writeRouteTypesManifest(routeTypesManifest, routeTypesFilePath)
1319+
await writeRouteTypesManifest(
1320+
routeTypesManifest,
1321+
routeTypesFilePath,
1322+
config
1323+
)
13201324
})
13211325

13221326
// Turbopack already handles conflicting app and page routes.

packages/next/src/build/webpack-config.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,6 @@ export default async function getBaseWebpackConfig(
389389

390390
const hasAppDir = !!appDir
391391
const disableOptimizedLoading = true
392-
const enableTypedRoutes = !!config.experimental.typedRoutes && hasAppDir
393392
const bundledReactChannel = needsExperimentalReact(config)
394393
? '-experimental'
395394
: ''
@@ -2152,7 +2151,6 @@ export default async function getBaseWebpackConfig(
21522151
dev,
21532152
isEdgeServer,
21542153
pageExtensions: config.pageExtensions,
2155-
typedRoutes: enableTypedRoutes,
21562154
cacheLifeConfig: config.experimental.cacheLife,
21572155
originalRewrites,
21582156
originalRedirects,

packages/next/src/build/webpack/plugins/next-types-plugin/index.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ describe('next-types-plugin', () => {
1111
dev: false,
1212
isEdgeServer: false,
1313
pageExtensions: ['tsx', 'ts', 'jsx', 'js'],
14-
typedRoutes: false,
1514
cacheLifeConfig: undefined,
1615
originalRewrites: undefined,
1716
originalRedirects: undefined,
@@ -40,7 +39,6 @@ describe('next-types-plugin', () => {
4039
dev: false,
4140
isEdgeServer: false,
4241
pageExtensions: ['tsx', 'ts', 'jsx', 'js'],
43-
typedRoutes: false,
4442
cacheLifeConfig: undefined,
4543
originalRewrites: undefined,
4644
originalRedirects: undefined,
@@ -61,7 +59,6 @@ describe('next-types-plugin', () => {
6159
dev: false,
6260
isEdgeServer: false,
6361
pageExtensions: ['tsx', 'ts', 'jsx', 'js'],
64-
typedRoutes: false,
6562
cacheLifeConfig: undefined,
6663
originalRewrites: undefined,
6764
originalRedirects: undefined,

0 commit comments

Comments
 (0)