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 。 |
這有幫助嗎?