transpilePackages

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

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

module.exports = nextConfig

版本歷史

版本變更
v13.0.0新增 transpilePackages

On this page