transpilePackages

Next.js 能够自动转译并打包来自本地包(如 monorepos)或外部依赖(node_modules)的依赖项。此功能替代了 next-transpile-modules 包。

next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
  transpilePackages: ['@acme/ui', 'lodash-es'],
}

module.exports = nextConfig

版本历史

版本变更
v13.0.0新增 transpilePackages 功能。

On this page