serverExternalPackages
选择退出将特定依赖项包含在 bundlePagesRouterDependencies
选项的自动捆绑中。
然后,这些页面将使用原生 Node.js require
来解析依赖项。
next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
serverExternalPackages: ['@acme/ui'],
}
module.exports = nextConfig
Next.js 包含一个 常用软件包的简短列表,这些软件包目前正在进行兼容性测试并已自动选择退出
@appsignal/nodejs
@aws-sdk/client-s3
@aws-sdk/s3-presigned-post
@blockfrost/blockfrost-js
@highlight-run/node
@jpg-store/lucid-cardano
@libsql/client
@mikro-orm/core
@mikro-orm/knex
@node-rs/argon2
@node-rs/bcrypt
@prisma/client
@react-pdf/renderer
@sentry/profiling-node
@sparticuz/chromium
@swc/core
argon2
autoprefixer
aws-crt
bcrypt
better-sqlite3
canvas
cpu-features
cypress
dd-trace
eslint
express
firebase-admin
import-in-the-middle
isolated-vm
jest
jsdom
keyv
libsql
mdx-bundler
mongodb
mongoose
newrelic
next-mdx-remote
next-seo
node-cron
node-pty
node-web-audio-api
oslo
pg
playwright
playwright-core
postcss
prettier
prisma
puppeteer-core
puppeteer
require-in-the-middle
rimraf
sharp
shiki
sqlite3
ts-node
ts-morph
typescript
vscode-oniguruma
webpack
websocket
zeromq
这有帮助吗?