transpilePackages

Next.js 能夠自動轉譯並打包來自本地套件(如 monorepos)或外部依賴(node_modules)的相依套件。此功能取代了 next-transpile-modules 套件。

next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
  transpilePackages: ['package-name'],
}

module.exports = nextConfig

版本歷史

版本變更內容
v13.0.0新增 transpilePackages 功能。

On this page