Skip to content

Commit

Permalink
Prevents externalizing non-hoisted packages (#8739)
Browse files Browse the repository at this point in the history
  • Loading branch information
arcanis authored and Timer committed Sep 14, 2019
1 parent 8cc6071 commit 9770d19
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/next/build/webpack-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,17 @@ export default async function getBaseWebpackConfig(
return callback()
}

let baseRes
try {
baseRes = resolveRequest(request, dir)
} catch (err) {}

// If the package, when required from the root, would be different from
// what the real resolution would use, then we cannot externalize it
if (baseRes !== res) {

This comment has been minimized.

Copy link
@remorses

remorses Sep 12, 2020

Contributor

@arcanis this check does not handle symlinks paths, you should resolve to the real paths before doing the check

This broke Nextjs use in pnpm #15616

This comment has been minimized.

Copy link
@arcanis

arcanis Sep 12, 2020

Author Contributor

Feel free to open a PR - however this code has been shipped since 9.0, and the OP in the thread you mention reports that it broke between 9.4 and 9.5, so might be different? Not sure, honestly.

return callback()
}

// Default pages have to be transpiled
if (
!res.match(/next[/\\]dist[/\\]next-server[/\\]/) &&
Expand Down

0 comments on commit 9770d19

Please sign in to comment.