Skip to content

Commit

Permalink
fix optoutBundlingPackages
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Oct 22, 2022
1 parent 43df52f commit a140c1f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions packages/next/build/webpack-config.ts
Expand Up @@ -1022,6 +1022,10 @@ export default async function getBaseWebpackConfig(
const crossOrigin = config.crossOrigin
const looseEsmExternals = config.experimental?.esmExternals === 'loose'

const optoutBundlingPackages = EXTERNAL_PACKAGES.concat(
...(config.experimental.serverComponentsExternalPackages || [])
)

async function handleExternals(
context: string,
request: string,
Expand Down Expand Up @@ -1188,12 +1192,7 @@ export default async function getBaseWebpackConfig(
if (layer === WEBPACK_LAYERS.server) {
// All packages should be bundled for the server layer if they're not opted out.
// This option takes priority over the transpilePackages option.
if (
isResourceInPackages(
res,
config.experimental.serverComponentsExternalPackages
)
) {
if (isResourceInPackages(res, optoutBundlingPackages)) {
return `${externalType} ${request}`
}

Expand Down

0 comments on commit a140c1f

Please sign in to comment.