-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
drop dynamic import with
ssr: false
on server-side (#32606)
- Loading branch information
Showing
10 changed files
with
130 additions
and
3 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
12 changes: 12 additions & 0 deletions
12
packages/next-swc/crates/core/tests/fixture/next-dynamic/duplicated-imports/output-server.js
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 @@ | ||
import dynamic1 from 'next/dynamic' | ||
import dynamic2 from 'next/dynamic' | ||
const DynamicComponent1 = dynamic1(() => import('../components/hello1'), { | ||
loadableGenerated: { | ||
modules: ['some-file.js -> ' + '../components/hello1'], | ||
}, | ||
}) | ||
const DynamicComponent2 = dynamic2(() => import('../components/hello2'), { | ||
loadableGenerated: { | ||
modules: ['some-file.js -> ' + '../components/hello2'], | ||
}, | ||
}) |
8 changes: 8 additions & 0 deletions
8
...es/next-swc/crates/core/tests/fixture/next-dynamic/member-with-same-name/output-server.js
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,8 @@ | ||
import dynamic from 'next/dynamic' | ||
import somethingElse from 'something-else' | ||
const DynamicComponent = dynamic(() => import('../components/hello'), { | ||
loadableGenerated: { | ||
modules: ['some-file.js -> ' + '../components/hello'], | ||
}, | ||
}) | ||
somethingElse.dynamic('should not be transformed') |
6 changes: 6 additions & 0 deletions
6
packages/next-swc/crates/core/tests/fixture/next-dynamic/no-options/output-server.js
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,6 @@ | ||
import dynamic from 'next/dynamic' | ||
const DynamicComponent = dynamic(() => import('../components/hello'), { | ||
loadableGenerated: { | ||
modules: ['some-file.js -> ' + '../components/hello'], | ||
}, | ||
}) |
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
16 changes: 16 additions & 0 deletions
16
packages/next-swc/crates/core/tests/fixture/next-dynamic/with-options/output-server.js
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,16 @@ | ||
import dynamic from 'next/dynamic' | ||
const DynamicComponentWithCustomLoading = dynamic( | ||
() => import('../components/hello'), | ||
{ | ||
loadableGenerated: { | ||
modules: ['some-file.js -> ' + '../components/hello'], | ||
}, | ||
loading: () => <p>...</p>, | ||
} | ||
) | ||
const DynamicClientOnlyComponent = dynamic(null, { | ||
loadableGenerated: { | ||
modules: ['some-file.js -> ' + '../components/hello'], | ||
}, | ||
ssr: false, | ||
}) |
11 changes: 11 additions & 0 deletions
11
packages/next-swc/crates/core/tests/fixture/next-dynamic/wrapped-import/output-server.js
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,11 @@ | ||
import dynamic from "next/dynamic"; | ||
const DynamicComponent = dynamic(null, { | ||
loadableGenerated: { | ||
modules: [ | ||
"some-file.js -> " + "./components/hello" | ||
] | ||
}, | ||
loading: ()=>null | ||
, | ||
ssr: false | ||
}); |