Skip to content

Commit

Permalink
fix check of symlinked files
Browse files Browse the repository at this point in the history
  • Loading branch information
remorses committed Sep 22, 2020
1 parent c6ff918 commit 3caacd5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/next/build/webpack-config.ts
@@ -1,7 +1,7 @@
import { codeFrameColumns } from '@babel/code-frame'
import ReactRefreshWebpackPlugin from '@next/react-refresh-utils/ReactRefreshWebpackPlugin'
import crypto from 'crypto'
import { readFileSync } from 'fs'
import { readFileSync, realpathSync } from 'fs'
import chalk from 'next/dist/compiled/chalk'
import semver from 'next/dist/compiled/semver'
import TerserPlugin from 'next/dist/compiled/terser-webpack-plugin'
Expand Down Expand Up @@ -665,7 +665,12 @@ export default async function getBaseWebpackConfig(
// Same as above: if the package, when required from the root,
// would be different from what the real resolution would use, we
// cannot externalize it.
if (baseRes !== res) {
if (
baseRes &&
baseRes !== res &&
// if res and baseRes are symlinks they could point to the the same file
realpathSync(baseRes) !== realpathSync(res)
) {
return callback()
}
}
Expand Down

0 comments on commit 3caacd5

Please sign in to comment.