轉譯套件 (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 。 |
這有幫助嗎?