Skip to content

Commit

Permalink
remove fields that based on import type
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed May 31, 2023
1 parent 8cd8cee commit ca1806a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
4 changes: 0 additions & 4 deletions packages/next-swc/crates/next-core/src/next_edge/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,6 @@ pub async fn get_edge_resolve_options_context(
custom_conditions: vec![
"edge-light".to_string(),
"worker".to_string(),
"browser".to_string(),
"import".to_string(),
"module".to_string(),
"default".to_string(),
"development".to_string(),
],
import_map: Some(next_edge_import_map),
Expand Down
11 changes: 2 additions & 9 deletions packages/next/src/build/webpack-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,7 @@ const asyncStoragesRegex =
/next[\\/]dist[\\/]client[\\/]components[\\/](static-generation-async-storage|action-async-storage|request-async-storage)/

// exports.<conditionName>
const edgeConditionNames = [
'edge-light',
'worker',
'browser',
'import',
'module',
'default',
]
const edgeConditionNames = ['edge-light', 'worker', 'browser', 'module']

// packageJson.<mainField>
const mainFieldsPerCompiler: Record<CompilerNameValues, string[]> = {
Expand Down Expand Up @@ -919,7 +912,7 @@ export default async function getBaseWebpackConfig(

const reactServerCondition = [
'react-server',
...(isEdgeServer ? edgeConditionNames : ['import', 'module', 'default']),
...(isEdgeServer ? edgeConditionNames : ['module']),
]

const clientEntries = isClient
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/app-dir/app-external/app-external.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ createNextDescribe(
expect(html).toContain('CJS package: cjs-lib')
})

it('should use the same react in server app', async () => {
it('should use the same react in edge server app', async () => {
const html = await next.render('/esm/edge-server')

const v1 = html.match(/App React Version: ([^<]+)</)[1]
Expand Down

0 comments on commit ca1806a

Please sign in to comment.