Skip to content

Commit e602d82

Browse files
authored
fix: enable SSR by utilizing pluginOptions and configuration (#3516)
1 parent 4ef21d2 commit e602d82

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

.changeset/flat-olives-check.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@module-federation/modern-js': patch
3+
---
4+
5+
fix: enable SSR by utilizing pluginOptions and configuration adjustments for improved accuracy

packages/modernjs/src/cli/ssrPlugin.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@ export const moduleFederationSSRPlugin = (
2424
],
2525
setup: async (api) => {
2626
const modernjsConfig = api.getConfig();
27-
const enableSSR = Boolean(modernjsConfig?.server?.ssr);
28-
if (!enableSSR || pluginOptions.userConfig?.ssr === false) {
29-
return {} as any;
27+
const enableSSR =
28+
pluginOptions.userConfig?.ssr === false
29+
? false
30+
: Boolean(modernjsConfig?.server?.ssr);
31+
if (!enableSSR) {
32+
return;
3033
}
3134

3235
setEnv();

0 commit comments

Comments
 (0)