-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix mixed module swc compilation for app router (#58967)
- Loading branch information
Showing
13 changed files
with
131 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
'use client' | ||
|
||
import dynamic from 'next/dynamic' | ||
|
||
const Dynamic = dynamic( | ||
() => import('mixed-syntax-esm').then((mod) => mod.Component), | ||
{ ssr: false } | ||
) | ||
|
||
export default function Page() { | ||
return <Dynamic /> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
'use client' | ||
|
||
import { value } from 'mixed-syntax-esm' | ||
|
||
export function Client() { | ||
return 'client:' + value | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
;(module) => { | ||
module.exports = {} | ||
} | ||
|
||
export const value = 'relative-mixed-syntax-esm' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { value } from 'mixed-syntax-esm' | ||
import { Client } from './client' | ||
import { value as relativeMixedValue } from './mixed-mod.mjs' | ||
|
||
export default function Page() { | ||
return ( | ||
<> | ||
<p id="server">{'server:' + value}</p> | ||
<p id="client"> | ||
<Client /> | ||
</p> | ||
<p id="relative-mixed">{relativeMixedValue}</p> | ||
</> | ||
) | ||
} |
14 changes: 14 additions & 0 deletions
14
test/e2e/app-dir/app-external/node_modules_bak/mixed-syntax-esm/index.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from 'react' | ||
;(module) => { | ||
module.exports = {} | ||
} | ||
|
||
export const value = 'mixed-syntax-esm' | ||
|
||
export function Component() { | ||
return /*#__PURE__*/ React.createElement( | ||
'p', | ||
{ id: 'component' }, | ||
'mixed-syntax-esm' | ||
) | ||
} |
3 changes: 3 additions & 0 deletions
3
test/e2e/app-dir/app-external/node_modules_bak/mixed-syntax-esm/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"exports": "./index.mjs" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters