serverComponentsExternalPackages

سيتم تجميع التبعيات المستخدمة داخل مكونات الخادم (Server Components) ومعالجات المسارات (Route Handlers) تلقائيًا بواسطة Next.js.

إذا كانت التبعية تستخدم ميزات محددة في Node.js، يمكنك اختيار استثناء تبعيات محددة من تجميع مكونات الخادم واستخدام require الأصلي في Node.js.

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

module.exports = nextConfig

يتضمن Next.js قائمة قصيرة من الحزم الشائعة التي تعمل حاليًا على التوافق ويتم استثناؤها تلقائيًا:

  • @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
  • @prisma/client
  • @react-pdf/renderer
  • @sentry/profiling-node
  • @swc/core
  • argon2
  • autoprefixer
  • aws-crt
  • bcrypt
  • better-sqlite3
  • canvas
  • cpu-features
  • cypress
  • eslint
  • express
  • firebase-admin
  • jest
  • jsdom
  • libsql
  • mdx-bundler
  • mongodb
  • mongoose
  • next-mdx-remote
  • next-seo
  • node-pty
  • node-web-audio-api
  • pg
  • playwright
  • postcss
  • prettier
  • prisma
  • puppeteer-core
  • puppeteer
  • rimraf
  • sharp
  • shiki
  • sqlite3
  • tailwindcss
  • ts-node
  • typescript
  • vscode-oniguruma
  • webpack
  • websocket
  • zeromq