跳到內容
設定next.config.jstranspilePackages

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