Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fixes vercel#29553

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
  • Loading branch information
sokra authored Oct 4, 2021
1 parent 92c2dd4 commit 1582251
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
14 changes: 12 additions & 2 deletions packages/next/build/webpack-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ export function attachReactRefresh(
export const NODE_RESOLVE_OPTIONS = {
dependencyType: 'commonjs',
modules: ['node_modules'],
alias: false,
fallback: false,
exportsFields: ['exports'],
importsFields: ['imports'],
Expand All @@ -197,13 +196,24 @@ export const NODE_RESOLVE_OPTIONS = {
restrictions: [],
}

export const NODE_BASE_RESOLVE_OPTIONS = {
...NODE_RESOLVE_OPTIONS,
alias: false,
}

export const NODE_ESM_RESOLVE_OPTIONS = {
...NODE_RESOLVE_OPTIONS,
alias: false,
dependencyType: 'esm',
conditionNames: ['node', 'import'],
fullySpecified: true,
}

export const NODE_BASE_ESM_RESOLVE_OPTIONS = {
...NODE_ESM_RESOLVE_OPTIONS,
alias: false,
}

let TSCONFIG_WARNED = false

export default async function getBaseWebpackConfig(
Expand Down Expand Up @@ -808,7 +818,7 @@ export default async function getBaseWebpackConfig(
let baseIsEsm: boolean
try {
const baseResolve = getResolve(
isEsm ? NODE_ESM_RESOLVE_OPTIONS : NODE_RESOLVE_OPTIONS
isEsm ? NODE_BASE_ESM_RESOLVE_OPTIONS : NODE_BASE_RESOLVE_OPTIONS
)
;[baseRes, baseIsEsm] = await baseResolve(dir, request)
} catch (err) {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions test/integration/externals/node_modules/preact/compat.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1582251

Please sign in to comment.