Skip to content

Commit

Permalink
check transpilePackages nullability
Browse files Browse the repository at this point in the history
  • Loading branch information
dvoytenko committed Dec 12, 2023
1 parent 46c62c3 commit 549ab01
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/next/src/build/webpack-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,10 @@ export default async function getBaseWebpackConfig(

// The `serverComponentsExternalPackages` should not conflict with
// the `transpilePackages`.
if (config.experimental.serverComponentsExternalPackages) {
if (
config.experimental.serverComponentsExternalPackages &&
config.transpilePackages
) {
const externalPackageConflicts = config.transpilePackages.filter((pkg) =>
config.experimental.serverComponentsExternalPackages?.includes(pkg)
)
Expand All @@ -745,7 +748,7 @@ export default async function getBaseWebpackConfig(
// For original request, such as `package name`
const optOutBundlingPackages = EXTERNAL_PACKAGES.concat(
...(config.experimental.serverComponentsExternalPackages || [])
).filter((pkg) => !config.transpilePackages.includes(pkg))
).filter((pkg) => !config.transpilePackages?.includes(pkg))
// For resolved request, such as `absolute path/package name/foo/bar.js`
const optOutBundlingPackageRegex = new RegExp(
`[/\\\\]node_modules[/\\\\](${optOutBundlingPackages
Expand Down

0 comments on commit 549ab01

Please sign in to comment.