serverComponentsExternalPackages
Dependencies used inside Server Components and Route Handlers will automatically be bundled by Next.js.
If a dependency is using Node.js specific features, you can choose to opt-out specific dependencies from the Server Components bundling and use native Node.js require.
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
serverComponentsExternalPackages: ['@acme/ui'],
},
}
module.exports = nextConfigNext.js includes a short list of popular packages that currently are working on compatibility and automatically opt-ed out:
@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/coreargon2autoprefixeraws-crtbcryptbetter-sqlite3canvascpu-featurescypresseslintexpressfirebase-adminjestjsdomlibsqlmdx-bundlermongodbmongoosenext-mdx-remotenext-seonode-ptynode-web-audio-apipgplaywrightpostcssprettierprismapuppeteer-corepuppeteerrimrafsharpshikisqlite3tailwindcssts-nodetypescriptvscode-onigurumawebpackwebsocketzeromq