Skip to content

Commit 579d3d5

Browse files
fix: rspack ssr occur error, because in config hook we can't get resolvedConfig. (#3670)
* fix: rspack ssr error * docs: add changeset
1 parent 1134fe2 commit 579d3d5

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

.changeset/lovely-cooks-complain.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@modern-js/runtime': patch
3+
---
4+
5+
fix: config hook can't get nomarlized config
6+
fix: config hook 不能拿到固定后的 config

packages/runtime/plugin-runtime/src/ssr/cli/index.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export default (): CliPlugin<AppTools> => ({
5454
'plugins',
5555
);
5656

57-
const userConfig = api.useResolvedConfigContext();
57+
const userConfig = api.useConfigContext();
5858
const { bundlerType = 'webpack' } = api.useAppContext();
5959
// eslint-disable-next-line consistent-return
6060
const babelConfig = (() => {
@@ -67,7 +67,10 @@ export default (): CliPlugin<AppTools> => ({
6767
path.join(__dirname, './babel-plugin-ssr-loader-id'),
6868
);
6969

70-
if (isUseSSRBundle(userConfig) && hasStringSSREntry(userConfig)) {
70+
if (
71+
isUseSSRBundle(userConfig) &&
72+
hasStringSSREntry(userConfig as any)
73+
) {
7174
config.plugins?.push(require.resolve('@loadable/babel-plugin'));
7275
}
7376
};
@@ -80,7 +83,7 @@ export default (): CliPlugin<AppTools> => ({
8083
config.plugins?.push(
8184
path.join(__dirname, './babel-plugin-ssr-loader-id'),
8285
);
83-
if (hasStringSSREntry(userConfig)) {
86+
if (hasStringSSREntry(userConfig as any)) {
8487
config.plugins?.push(
8588
require.resolve('@loadable/babel-plugin'),
8689
);

0 commit comments

Comments
 (0)