ssr-plugin-react 6.1.15 → 6.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/cjs/entry/server-entry.js +3 -2
- package/cjs/tools/vite.js +9 -2
- package/esm/entry/server-entry.js +3 -2
- package/esm/tools/vite.js +9 -2
- package/package.json +2 -2
- package/src/entry/server-entry.tsx +2 -2
- package/src/tools/vite.ts +9 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,20 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [6.1.16](https://github.com/zhangyuang/ssr/compare/v6.1.15...v6.1.16) (2021-12-06)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* add keepNames when esbuild compile plugin-react jsxRuntime use classic ([8502e6c](https://github.com/zhangyuang/ssr/commit/8502e6ca898fd99e936e60af2093fb6b174f6aab))
|
|
12
|
+
* component evaluating in csr mode ([#138](https://github.com/zhangyuang/ssr/issues/138)) ([66f5f09](https://github.com/zhangyuang/ssr/commit/66f5f09963502588bd59a09ff839d1dae8947817))
|
|
13
|
+
* plugin-react csr ([572c6c0](https://github.com/zhangyuang/ssr/commit/572c6c092c63c915da15883e1d34ad26a5a6cadd))
|
|
14
|
+
* plugin-react csr ([ab51062](https://github.com/zhangyuang/ssr/commit/ab510626946234de436a55184937d018c8c0e514))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
6
20
|
## [6.1.15](https://github.com/zhangyuang/ssr/compare/v6.1.14...v6.1.15) (2021-12-05)
|
|
7
21
|
|
|
8
22
|
**Note:** Version bump only for package ssr-plugin-react
|
|
@@ -74,7 +74,7 @@ const serverRender = async (ctx, config) => {
|
|
|
74
74
|
};
|
|
75
75
|
const isCsr = !!(mode === 'csr' || ((_a = ctx.request.query) === null || _a === void 0 ? void 0 : _a.csr));
|
|
76
76
|
const { component, fetch } = routeItem;
|
|
77
|
-
const Component = (await component()).default;
|
|
77
|
+
const Component = isCsr ? React.Fragment : (await component()).default;
|
|
78
78
|
if (isCsr) {
|
|
79
79
|
(0, ssr_server_utils_1.logGreen)(`Current path ${path} use csr render mode`);
|
|
80
80
|
}
|
|
@@ -100,6 +100,7 @@ const serverRender = async (ctx, config) => {
|
|
|
100
100
|
} });
|
|
101
101
|
return (React.createElement(react_router_dom_1.StaticRouter, { location: ctx.request.url },
|
|
102
102
|
React.createElement(create_context_1.STORE_CONTEXT.Provider, { value: { state: combineData } },
|
|
103
|
-
React.createElement(index_tsx_1.default, { ctx: ctx, config: config, staticList: staticList, injectState: injectState },
|
|
103
|
+
React.createElement(index_tsx_1.default, { ctx: ctx, config: config, staticList: staticList, injectState: injectState },
|
|
104
|
+
React.createElement(Component, null)))));
|
|
104
105
|
};
|
|
105
106
|
exports.serverRender = serverRender;
|
package/cjs/tools/vite.js
CHANGED
|
@@ -9,7 +9,9 @@ const { clientOutPut, serverOutPut } = getOutput();
|
|
|
9
9
|
const serverConfig = {
|
|
10
10
|
...(0, ssr_server_utils_1.commonConfig)(),
|
|
11
11
|
plugins: [
|
|
12
|
-
(0, plugin_react_1.default)(
|
|
12
|
+
(0, plugin_react_1.default)({
|
|
13
|
+
jsxRuntime: 'classic'
|
|
14
|
+
})
|
|
13
15
|
],
|
|
14
16
|
build: {
|
|
15
17
|
ssr: reactServerEntry,
|
|
@@ -27,8 +29,13 @@ const serverConfig = {
|
|
|
27
29
|
exports.serverConfig = serverConfig;
|
|
28
30
|
const clientConfig = {
|
|
29
31
|
...(0, ssr_server_utils_1.commonConfig)(),
|
|
32
|
+
esbuild: {
|
|
33
|
+
keepNames: true
|
|
34
|
+
},
|
|
30
35
|
plugins: [
|
|
31
|
-
(0, plugin_react_1.default)(
|
|
36
|
+
(0, plugin_react_1.default)({
|
|
37
|
+
jsxRuntime: 'classic'
|
|
38
|
+
})
|
|
32
39
|
],
|
|
33
40
|
build: {
|
|
34
41
|
ssrManifest: true,
|
|
@@ -71,7 +71,7 @@ const serverRender = async (ctx, config) => {
|
|
|
71
71
|
};
|
|
72
72
|
const isCsr = !!(mode === 'csr' || ((_a = ctx.request.query) === null || _a === void 0 ? void 0 : _a.csr));
|
|
73
73
|
const { component, fetch } = routeItem;
|
|
74
|
-
const Component = (await component()).default;
|
|
74
|
+
const Component = isCsr ? React.Fragment : (await component()).default;
|
|
75
75
|
if (isCsr) {
|
|
76
76
|
logGreen(`Current path ${path} use csr render mode`);
|
|
77
77
|
}
|
|
@@ -97,6 +97,7 @@ const serverRender = async (ctx, config) => {
|
|
|
97
97
|
} });
|
|
98
98
|
return (React.createElement(StaticRouter, { location: ctx.request.url },
|
|
99
99
|
React.createElement(Context.Provider, { value: { state: combineData } },
|
|
100
|
-
React.createElement(Layout, { ctx: ctx, config: config, staticList: staticList, injectState: injectState },
|
|
100
|
+
React.createElement(Layout, { ctx: ctx, config: config, staticList: staticList, injectState: injectState },
|
|
101
|
+
React.createElement(Component, null)))));
|
|
101
102
|
};
|
|
102
103
|
export { serverRender };
|
package/esm/tools/vite.js
CHANGED
|
@@ -6,7 +6,9 @@ const { clientOutPut, serverOutPut } = getOutput();
|
|
|
6
6
|
const serverConfig = {
|
|
7
7
|
...commonConfig(),
|
|
8
8
|
plugins: [
|
|
9
|
-
react(
|
|
9
|
+
react({
|
|
10
|
+
jsxRuntime: 'classic'
|
|
11
|
+
})
|
|
10
12
|
],
|
|
11
13
|
build: {
|
|
12
14
|
ssr: reactServerEntry,
|
|
@@ -23,8 +25,13 @@ const serverConfig = {
|
|
|
23
25
|
};
|
|
24
26
|
const clientConfig = {
|
|
25
27
|
...commonConfig(),
|
|
28
|
+
esbuild: {
|
|
29
|
+
keepNames: true
|
|
30
|
+
},
|
|
26
31
|
plugins: [
|
|
27
|
-
react(
|
|
32
|
+
react({
|
|
33
|
+
jsxRuntime: 'classic'
|
|
34
|
+
})
|
|
28
35
|
],
|
|
29
36
|
build: {
|
|
30
37
|
ssrManifest: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ssr-plugin-react",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.16",
|
|
4
4
|
"description": "plugin-react for ssr",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"@types/webpack": "^4.41.10",
|
|
74
74
|
"ssr-types-react": "^6.1.15"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "e8e142e95ad7d0b11864bf7caf982de0c2af38d6"
|
|
77
77
|
}
|
|
@@ -80,7 +80,7 @@ const serverRender = async (ctx: ISSRContext, config: IConfig): Promise<React.Re
|
|
|
80
80
|
|
|
81
81
|
const isCsr = !!(mode === 'csr' || ctx.request.query?.csr)
|
|
82
82
|
const { component, fetch } = routeItem
|
|
83
|
-
const Component = (await component()).default
|
|
83
|
+
const Component = isCsr ? React.Fragment : (await component()).default
|
|
84
84
|
|
|
85
85
|
if (isCsr) {
|
|
86
86
|
logGreen(`Current path ${path} use csr render mode`)
|
|
@@ -111,7 +111,7 @@ const serverRender = async (ctx: ISSRContext, config: IConfig): Promise<React.Re
|
|
|
111
111
|
<StaticRouter location={ctx.request.url}>
|
|
112
112
|
<Context.Provider value={{ state: combineData }}>
|
|
113
113
|
<Layout ctx={ctx} config={config} staticList={staticList} injectState={injectState}>
|
|
114
|
-
|
|
114
|
+
<Component />
|
|
115
115
|
</Layout>
|
|
116
116
|
</Context.Provider>
|
|
117
117
|
</StaticRouter>
|
package/src/tools/vite.ts
CHANGED
|
@@ -8,7 +8,9 @@ const { clientOutPut, serverOutPut } = getOutput()
|
|
|
8
8
|
const serverConfig: UserConfig = {
|
|
9
9
|
...commonConfig(),
|
|
10
10
|
plugins: [
|
|
11
|
-
react(
|
|
11
|
+
react({
|
|
12
|
+
jsxRuntime: 'classic'
|
|
13
|
+
})
|
|
12
14
|
],
|
|
13
15
|
build: {
|
|
14
16
|
ssr: reactServerEntry,
|
|
@@ -26,8 +28,13 @@ const serverConfig: UserConfig = {
|
|
|
26
28
|
|
|
27
29
|
const clientConfig: UserConfig = {
|
|
28
30
|
...commonConfig(),
|
|
31
|
+
esbuild: {
|
|
32
|
+
keepNames: true
|
|
33
|
+
},
|
|
29
34
|
plugins: [
|
|
30
|
-
react(
|
|
35
|
+
react({
|
|
36
|
+
jsxRuntime: 'classic'
|
|
37
|
+
})
|
|
31
38
|
],
|
|
32
39
|
build: {
|
|
33
40
|
ssrManifest: true,
|