ssr-plugin-react 6.1.28 → 6.1.30
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 +29 -0
- package/cjs/tools/vite.js +14 -8
- package/esm/tools/vite.js +14 -8
- package/package.json +7 -7
- package/src/tools/vite.ts +9 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,35 @@
|
|
|
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.30](https://github.com/zhangyuang/ssr/compare/v6.1.29...v6.1.30) (2021-12-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* node12 vite ssr optimize ([88fb3c9](https://github.com/zhangyuang/ssr/commit/88fb3c935bdc7aa05d44f682e0e14f7ed09be8c9))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [6.1.29](https://github.com/zhangyuang/ssr/compare/v6.1.28...v6.1.29) (2021-12-17)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* vite in server side optimize deps ([b9af6f4](https://github.com/zhangyuang/ssr/commit/b9af6f4de403af9b2909d82c5dde8bd161d98397))
|
|
23
|
+
* vite optimize ([f690358](https://github.com/zhangyuang/ssr/commit/f6903589bfd317b464aecb17db5acaca336dda31))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Features
|
|
27
|
+
|
|
28
|
+
* support common plugin in vite ([6a0a3ab](https://github.com/zhangyuang/ssr/commit/6a0a3ab0e6b7a43179053a02342db303f40cfbd6))
|
|
29
|
+
* support optionalchaining when node version less than 14 ([3b4bc90](https://github.com/zhangyuang/ssr/commit/3b4bc9044df5826bc7c9810bca4d8ccb0c6ad4fd))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
6
35
|
## [6.1.28](https://github.com/zhangyuang/ssr/compare/v6.1.25...v6.1.28) (2021-12-16)
|
|
7
36
|
|
|
8
37
|
|
package/cjs/tools/vite.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
2
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.clientConfig = exports.serverConfig = exports.viteStart = exports.viteBuild = void 0;
|
|
5
5
|
const ssr_server_utils_1 = require("ssr-server-utils");
|
|
6
6
|
const plugin_react_1 = require("@vitejs/plugin-react");
|
|
7
7
|
const vite_plugin_style_import_1 = require("vite-plugin-style-import");
|
|
8
8
|
const build = require('vite').build;
|
|
9
|
-
const { getOutput, reactServerEntry, reactClientEntry, viteConfig,
|
|
9
|
+
const { getOutput, reactServerEntry, reactClientEntry, viteConfig, supportOptinalChaining } = (0, ssr_server_utils_1.loadConfig)();
|
|
10
10
|
const { clientOutPut, serverOutPut } = getOutput();
|
|
11
11
|
const styleImportConfig = {
|
|
12
12
|
include: ['**/*.vue', '**/*.ts', '**/*.js', '**/*.tsx', '**/*.jsx', /chunkName/],
|
|
@@ -20,18 +20,23 @@ const styleImportConfig = {
|
|
|
20
20
|
};
|
|
21
21
|
const serverConfig = {
|
|
22
22
|
...(0, ssr_server_utils_1.commonConfig)(),
|
|
23
|
+
optimizeDeps: {
|
|
24
|
+
include: ['path-to-regexp', 'react-dom'],
|
|
25
|
+
exclude: ['ssr-server-utils']
|
|
26
|
+
},
|
|
23
27
|
plugins: [
|
|
24
28
|
(0, plugin_react_1.default)({
|
|
25
29
|
...(_b = (_a = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _a === void 0 ? void 0 : _a.server) === null || _b === void 0 ? void 0 : _b.defaultPluginOptions,
|
|
26
30
|
jsxRuntime: 'classic',
|
|
27
|
-
babel:
|
|
31
|
+
babel: !supportOptinalChaining && {
|
|
28
32
|
plugins: [
|
|
29
33
|
'@babel/plugin-proposal-optional-chaining',
|
|
30
34
|
'@babel/plugin-proposal-nullish-coalescing-operator'
|
|
31
35
|
]
|
|
32
36
|
}
|
|
33
37
|
}),
|
|
34
|
-
(_d = (_c = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _c === void 0 ? void 0 : _c.
|
|
38
|
+
(_d = (_c = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _c === void 0 ? void 0 : _c.common) === null || _d === void 0 ? void 0 : _d.extraPlugin,
|
|
39
|
+
(_f = (_e = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _e === void 0 ? void 0 : _e.server) === null || _f === void 0 ? void 0 : _f.extraPlugin,
|
|
35
40
|
(0, vite_plugin_style_import_1.default)(styleImportConfig)
|
|
36
41
|
],
|
|
37
42
|
build: {
|
|
@@ -45,7 +50,7 @@ const serverConfig = {
|
|
|
45
50
|
},
|
|
46
51
|
define: {
|
|
47
52
|
__isBrowser__: false,
|
|
48
|
-
...(
|
|
53
|
+
...(_h = (_g = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _g === void 0 ? void 0 : _g.server) === null || _h === void 0 ? void 0 : _h.define
|
|
49
54
|
}
|
|
50
55
|
};
|
|
51
56
|
exports.serverConfig = serverConfig;
|
|
@@ -56,10 +61,11 @@ const clientConfig = {
|
|
|
56
61
|
},
|
|
57
62
|
plugins: [
|
|
58
63
|
(0, plugin_react_1.default)({
|
|
59
|
-
...(
|
|
64
|
+
...(_k = (_j = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _j === void 0 ? void 0 : _j.client) === null || _k === void 0 ? void 0 : _k.defaultPluginOptions,
|
|
60
65
|
jsxRuntime: 'classic'
|
|
61
66
|
}),
|
|
62
|
-
(
|
|
67
|
+
(_m = (_l = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _l === void 0 ? void 0 : _l.common) === null || _m === void 0 ? void 0 : _m.extraPlugin,
|
|
68
|
+
(_p = (_o = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _o === void 0 ? void 0 : _o.client) === null || _p === void 0 ? void 0 : _p.extraPlugin,
|
|
63
69
|
(0, vite_plugin_style_import_1.default)(styleImportConfig)
|
|
64
70
|
],
|
|
65
71
|
build: {
|
|
@@ -73,7 +79,7 @@ const clientConfig = {
|
|
|
73
79
|
},
|
|
74
80
|
define: {
|
|
75
81
|
__isBrowser__: true,
|
|
76
|
-
...(
|
|
82
|
+
...(_r = (_q = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _q === void 0 ? void 0 : _q.client) === null || _r === void 0 ? void 0 : _r.define
|
|
77
83
|
}
|
|
78
84
|
};
|
|
79
85
|
exports.clientConfig = clientConfig;
|
package/esm/tools/vite.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
1
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
2
2
|
import { loadConfig, chunkNamePlugin, rollupOutputOptions, manifestPlugin, commonConfig } from 'ssr-server-utils';
|
|
3
3
|
import react from '@vitejs/plugin-react';
|
|
4
4
|
import styleImport, { AndDesignVueResolve, VantResolve, ElementPlusResolve, NutuiResolve, AntdResolve } from 'vite-plugin-style-import';
|
|
5
5
|
const build = require('vite').build;
|
|
6
|
-
const { getOutput, reactServerEntry, reactClientEntry, viteConfig,
|
|
6
|
+
const { getOutput, reactServerEntry, reactClientEntry, viteConfig, supportOptinalChaining } = loadConfig();
|
|
7
7
|
const { clientOutPut, serverOutPut } = getOutput();
|
|
8
8
|
const styleImportConfig = {
|
|
9
9
|
include: ['**/*.vue', '**/*.ts', '**/*.js', '**/*.tsx', '**/*.jsx', /chunkName/],
|
|
@@ -17,18 +17,23 @@ const styleImportConfig = {
|
|
|
17
17
|
};
|
|
18
18
|
const serverConfig = {
|
|
19
19
|
...commonConfig(),
|
|
20
|
+
optimizeDeps: {
|
|
21
|
+
include: ['path-to-regexp', 'react-dom'],
|
|
22
|
+
exclude: ['ssr-server-utils']
|
|
23
|
+
},
|
|
20
24
|
plugins: [
|
|
21
25
|
react({
|
|
22
26
|
...(_b = (_a = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _a === void 0 ? void 0 : _a.server) === null || _b === void 0 ? void 0 : _b.defaultPluginOptions,
|
|
23
27
|
jsxRuntime: 'classic',
|
|
24
|
-
babel:
|
|
28
|
+
babel: !supportOptinalChaining && {
|
|
25
29
|
plugins: [
|
|
26
30
|
'@babel/plugin-proposal-optional-chaining',
|
|
27
31
|
'@babel/plugin-proposal-nullish-coalescing-operator'
|
|
28
32
|
]
|
|
29
33
|
}
|
|
30
34
|
}),
|
|
31
|
-
(_d = (_c = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _c === void 0 ? void 0 : _c.
|
|
35
|
+
(_d = (_c = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _c === void 0 ? void 0 : _c.common) === null || _d === void 0 ? void 0 : _d.extraPlugin,
|
|
36
|
+
(_f = (_e = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _e === void 0 ? void 0 : _e.server) === null || _f === void 0 ? void 0 : _f.extraPlugin,
|
|
32
37
|
styleImport(styleImportConfig)
|
|
33
38
|
],
|
|
34
39
|
build: {
|
|
@@ -42,7 +47,7 @@ const serverConfig = {
|
|
|
42
47
|
},
|
|
43
48
|
define: {
|
|
44
49
|
__isBrowser__: false,
|
|
45
|
-
...(
|
|
50
|
+
...(_h = (_g = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _g === void 0 ? void 0 : _g.server) === null || _h === void 0 ? void 0 : _h.define
|
|
46
51
|
}
|
|
47
52
|
};
|
|
48
53
|
const clientConfig = {
|
|
@@ -52,10 +57,11 @@ const clientConfig = {
|
|
|
52
57
|
},
|
|
53
58
|
plugins: [
|
|
54
59
|
react({
|
|
55
|
-
...(
|
|
60
|
+
...(_k = (_j = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _j === void 0 ? void 0 : _j.client) === null || _k === void 0 ? void 0 : _k.defaultPluginOptions,
|
|
56
61
|
jsxRuntime: 'classic'
|
|
57
62
|
}),
|
|
58
|
-
(
|
|
63
|
+
(_m = (_l = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _l === void 0 ? void 0 : _l.common) === null || _m === void 0 ? void 0 : _m.extraPlugin,
|
|
64
|
+
(_p = (_o = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _o === void 0 ? void 0 : _o.client) === null || _p === void 0 ? void 0 : _p.extraPlugin,
|
|
59
65
|
styleImport(styleImportConfig)
|
|
60
66
|
],
|
|
61
67
|
build: {
|
|
@@ -69,7 +75,7 @@ const clientConfig = {
|
|
|
69
75
|
},
|
|
70
76
|
define: {
|
|
71
77
|
__isBrowser__: true,
|
|
72
|
-
...(
|
|
78
|
+
...(_r = (_q = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _q === void 0 ? void 0 : _q.client) === null || _r === void 0 ? void 0 : _r.define
|
|
73
79
|
}
|
|
74
80
|
};
|
|
75
81
|
const viteStart = async () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ssr-plugin-react",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.30",
|
|
4
4
|
"description": "plugin-react for ssr",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -56,10 +56,10 @@
|
|
|
56
56
|
"postcss-safe-parser": "4.0.1",
|
|
57
57
|
"react-dev-utils": "^11.0.4",
|
|
58
58
|
"serialize-javascript": "^6.0.0",
|
|
59
|
-
"ssr-client-utils": "^6.1.
|
|
60
|
-
"ssr-hoc-react": "^6.1.
|
|
61
|
-
"ssr-server-utils": "^6.1.
|
|
62
|
-
"ssr-webpack": "^6.1.
|
|
59
|
+
"ssr-client-utils": "^6.1.29",
|
|
60
|
+
"ssr-hoc-react": "^6.1.29",
|
|
61
|
+
"ssr-server-utils": "^6.1.29",
|
|
62
|
+
"ssr-webpack": "^6.1.29",
|
|
63
63
|
"terser-webpack-plugin": "^2.3.5",
|
|
64
64
|
"url-loader": "^4.1.1",
|
|
65
65
|
"vite": "^2.7.0",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"@types/react-dom": "^17.0.0",
|
|
75
75
|
"@types/react-router-dom": "^5.1.3",
|
|
76
76
|
"@types/webpack": "^4.41.10",
|
|
77
|
-
"ssr-types-react": "^6.1.
|
|
77
|
+
"ssr-types-react": "^6.1.29"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "880fd2d12752666a1d89dd37f30bf1fef801b0b2"
|
|
80
80
|
}
|
package/src/tools/vite.ts
CHANGED
|
@@ -10,7 +10,8 @@ import styleImport, {
|
|
|
10
10
|
} from 'vite-plugin-style-import'
|
|
11
11
|
|
|
12
12
|
const build: typeof BuildType = require('vite').build
|
|
13
|
-
const { getOutput, reactServerEntry, reactClientEntry, viteConfig,
|
|
13
|
+
const { getOutput, reactServerEntry, reactClientEntry, viteConfig, supportOptinalChaining } = loadConfig()
|
|
14
|
+
|
|
14
15
|
const { clientOutPut, serverOutPut } = getOutput()
|
|
15
16
|
const styleImportConfig = {
|
|
16
17
|
include: ['**/*.vue', '**/*.ts', '**/*.js', '**/*.tsx', '**/*.jsx', /chunkName/],
|
|
@@ -24,17 +25,22 @@ const styleImportConfig = {
|
|
|
24
25
|
}
|
|
25
26
|
const serverConfig: UserConfig = {
|
|
26
27
|
...commonConfig(),
|
|
28
|
+
optimizeDeps: {
|
|
29
|
+
include: ['path-to-regexp', 'react-dom'],
|
|
30
|
+
exclude: ['ssr-server-utils']
|
|
31
|
+
},
|
|
27
32
|
plugins: [
|
|
28
33
|
react({
|
|
29
34
|
...viteConfig?.()?.server?.defaultPluginOptions,
|
|
30
35
|
jsxRuntime: 'classic',
|
|
31
|
-
babel:
|
|
36
|
+
babel: !supportOptinalChaining && {
|
|
32
37
|
plugins: [
|
|
33
38
|
'@babel/plugin-proposal-optional-chaining',
|
|
34
39
|
'@babel/plugin-proposal-nullish-coalescing-operator'
|
|
35
40
|
]
|
|
36
41
|
}
|
|
37
42
|
}),
|
|
43
|
+
viteConfig?.()?.common?.extraPlugin,
|
|
38
44
|
viteConfig?.()?.server?.extraPlugin,
|
|
39
45
|
styleImport(styleImportConfig)
|
|
40
46
|
],
|
|
@@ -63,6 +69,7 @@ const clientConfig: UserConfig = {
|
|
|
63
69
|
...viteConfig?.()?.client?.defaultPluginOptions,
|
|
64
70
|
jsxRuntime: 'classic'
|
|
65
71
|
}),
|
|
72
|
+
viteConfig?.()?.common?.extraPlugin,
|
|
66
73
|
viteConfig?.()?.client?.extraPlugin,
|
|
67
74
|
styleImport(styleImportConfig)
|
|
68
75
|
],
|