跳至內容
API 參考next.config.js 選項轉譯套件 (transpilePackages)

轉譯套件 (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