Skip to content

Commit

Permalink
Stop using edge condition names as main fields
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Jun 12, 2024
1 parent 630c103 commit bce8810
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions packages/next/src/build/webpack-config-rules/resolve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,13 @@ export const edgeConditionNames = [
'...',
]

const mainFieldsPerCompiler: Record<
CompilerNameValues | 'server-esm',
string[]
> = {
const mainFieldsPerCompiler = {
// For default case, prefer CJS over ESM on server side. e.g. pages dir SSR
[COMPILER_NAMES.server]: ['main', 'module'],
[COMPILER_NAMES.client]: ['browser', 'module', 'main'],
[COMPILER_NAMES.edgeServer]: edgeConditionNames,
// For bundling-all strategy, prefer ESM over CJS
'server-esm': ['module', 'main'],
}
} as const

export function getMainField(
compilerType: CompilerNameValues,
Expand Down

0 comments on commit bce8810

Please sign in to comment.