logoNext.js 繁體中文
文件部落格學習
入門指南
安裝指南
專案結構
版面配置與頁面
連結與導航
圖片
字體
CSS
伺服器與客戶端元件
資料獲取
快取與重新驗證
更新資料
錯誤處理
部分預渲染
元數據與 OG 圖片
部署
升級指南
指南
建構您的應用程式
深入解析
API 參考文檔
Edge Runtime 邊緣運行時
Turbopack
指令 (Directives)
元件
檔案系統慣例
函式
配置
TypeScript
ESLint
next.config.js
allowedDevOrigins
appDir
assetPrefix
authInterrupts
basePath
cacheLife
compress
crossOrigin
cssChunking
devIndicators
distDir
dynamicIO
env
eslint
expireTime
exportPathMap
generateBuildId
generateEtags
headers
htmlLimitedBots
httpAgentOptions
圖片
cacheHandler
inlineCss
日誌記錄
mdxRs
onDemandEntries
optimizePackageImports
output
pageExtensions
poweredByHeader
部分預渲染 (PPR)
productionBrowserSourceMaps
reactCompiler
reactMaxHeadersLength
reactStrictMode
重新導向 (redirects)
rewrites
sassOptions
serverActions
serverComponentsHmrCache
serverExternalPackages
staleTimes
staticGeneration*
taint
trailingSlash
transpilePackages
turbopack
typedRoutes
TypeScript
urlImports
useCache
useLightningcss
viewTransition
webpack
webVitalsAttribution
CLI
架構
社群
logoNext.js 繁體中文
文件部落格學習
介紹/API 參考文檔/配置/next.config.js/typedRoutes

typedRoutes

實驗性支援 靜態類型連結 (statically typed links)。此功能需在專案中使用 App Router 及 TypeScript。

next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
  experimental: {
    typedRoutes: true,
  },
}

module.exports = nextConfig

turbopack

設定 Next.js 的 Turbopack 專屬選項

TypeScript

Next.js 預設會回報 TypeScript 錯誤。在此了解如何停用此行為。