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 。 |
这有帮助吗?