ssr-plugin-react 6.1.22-alpha.1 → 6.1.25
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 +38 -0
- package/README.md +26 -26
- package/cjs/config/base.js +5 -7
- package/cjs/tools/vite.js +8 -2
- package/esm/config/base.js +6 -8
- package/esm/tools/vite.js +8 -2
- package/package.json +10 -8
- package/src/config/base.ts +7 -8
- package/src/tools/vite.ts +10 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,44 @@
|
|
|
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.25](https://github.com/zhangyuang/ssr/compare/v6.1.24...v6.1.25) (2021-12-16)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add vite test ([#148](https://github.com/zhangyuang/ssr/issues/148)) ([efce102](https://github.com/zhangyuang/ssr/commit/efce102ebe1be25c1275712042b1ee0e7b088568))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [6.1.24](https://github.com/zhangyuang/ssr/compare/v6.1.23...v6.1.24) (2021-12-13)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package ssr-plugin-react
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## [6.1.23](https://github.com/zhangyuang/ssr/compare/v6.1.22...v6.1.23) (2021-12-13)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Features
|
|
29
|
+
|
|
30
|
+
* support alias config ([551c9be](https://github.com/zhangyuang/ssr/commit/551c9be1741f63443381cc897166fb640fa8718d))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
## [6.1.22](https://github.com/zhangyuang/ssr/compare/v6.1.22-alpha.1...v6.1.22) (2021-12-11)
|
|
37
|
+
|
|
38
|
+
**Note:** Version bump only for package ssr-plugin-react
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
6
44
|
## [6.1.22-alpha.1](https://github.com/zhangyuang/ssr/compare/v6.1.22-alpha.0...v6.1.22-alpha.1) (2021-12-11)
|
|
7
45
|
|
|
8
46
|
|
package/README.md
CHANGED
|
@@ -53,22 +53,28 @@
|
|
|
53
53
|
</b></td>
|
|
54
54
|
<td align="center"><a target="_blank" href="https://yulebao.alibaba.com/"><img src="https://gw.alicdn.com/tfs/TB1CmlIIFT7gK0jSZFpXXaTkpXa-190-46.png" width="100px;"/><br><sub><b>阿里影业娱乐宝
|
|
55
55
|
</b></sub></a></td>
|
|
56
|
-
<td align="center"><a target="_blank" href="https://campaign.vmate.com/vrbollywood"><img src="https://img.alicdn.com/tfs/TB17p6Vhbj1gK0jSZFOXXc7GpXa-512-512.png" width="100px;" alt="vmate 积分商城"/><br />
|
|
57
|
-
<a target="_blank" href="https://job.alibaba.com/zhaopin/position_detail.htm?trace=qrcode_share&positionCode=GP524819"><sub><b>Vmate短视频
|
|
58
|
-
</b></a></td>
|
|
59
|
-
<td align="center"><a target="_blank" href="https://enjoysales.paat.com/"><img src="https://img.alicdn.com/tfs/TB1Ma0BiEY1gK0jSZFMXXaWcVXa-836-836.png" width="100px;" alt="火炽星原CRM"/><br />
|
|
60
|
-
<a target="_blank" href="https://enjoysales.paat.com/"><sub><b>火炽星原CRM
|
|
61
|
-
</b></a></td>
|
|
62
56
|
<td align="center"><a href="https://www.niuniuda.com/mall" target="_blank"><img src="https://img.alicdn.com/tfs/TB1df_8pBr0gK0jSZFnXXbRRXXa-160-60.png" width="100px;" alt="牛牛搭"/><br />
|
|
63
57
|
<a href="https://www.niuniuda.com/mall" target="_blank"><sub><b>牛牛搭
|
|
64
58
|
</b></a></td>
|
|
59
|
+
<td align="center"><a href="https://www.gszq.com/" target="_blank"><img src="https://www.gszq.com/static/media/icon-slogan.4d1c7974.png
|
|
60
|
+
" width="100px;" alt="国盛证券"/><br />
|
|
61
|
+
<a href="https://www.gszq.com/" target="_bvlank"><sub><b>国盛证券
|
|
62
|
+
</b></a></td>
|
|
63
|
+
<td align="center"><a href="https://m.isle.org.cn" target="_blank"><img src="https://res.wx.qq.com/op_res/qzBjcpT1AZDopDDkEJfj5gKFADotYHTgD33lz9xvZUIj7VJaIR_8HE4lfOxwaiYBgi4V2xXm0xLmAcdQxF4IrQ" width="100px;" alt="三易科技"/><br />
|
|
64
|
+
<a href="https://m.isle.org.cn" target="_bvlank"><sub><b>三易科技
|
|
65
|
+
</b></a></td>
|
|
65
66
|
<td align="center"><a href="https://help.seewo.com/" target="_blank"><img src="https://img.alicdn.com/tfs/TB11Xo3q4v1gK0jSZFFXXb0sXXa-350-55.png" width="100px;" alt="cvte"/><br /><a href="https://help.seewo.com/" target="_blank"><sub><b>希沃帮助中心
|
|
66
67
|
</b></a></td>
|
|
67
68
|
<td align="center"><a href="https://wecard.qq.com/index/" target="_blank"><img src="https://img.alicdn.com/tfs/TB1pTZGrFT7gK0jSZFpXXaTkpXa-164-164.jpg" width="100px;" alt="腾讯微卡"/><br />
|
|
68
69
|
<a href="https://wecard.qq.com/index/" target="_blank"><sub><b>腾讯微卡
|
|
69
70
|
</b></a></td>
|
|
70
|
-
<td align="center"><a href="https://www.
|
|
71
|
-
|
|
71
|
+
<td align="center" style="height: 100px"><a href="https://www.habisummercamp.com/" target="_blank"><img src="https://res.wx.qq.com/op_res/XXUpF56bDue53vZadoCSPSnqKF3bZqPOQnqsPa_ngEARa0OUIW22pX7eKsftPb6pc5ny62cR_wXM4g5xJ7G3DQ
|
|
72
|
+
" width="200px;margin: 20px 0" alt="Happy"/><br />
|
|
73
|
+
<a href="https://www.habisummercamp.com/" target="_bvlank"><b>HappyPC
|
|
74
|
+
</b></a></td>
|
|
75
|
+
<td align="center" style="height: 100px"><a href="https://m.habisummercamp.com/" target="_blank"><img src="https://res.wx.qq.com/op_res/XXUpF56bDue53vZadoCSPSnqKF3bZqPOQnqsPa_ngEARa0OUIW22pX7eKsftPb6pc5ny62cR_wXM4g5xJ7G3DQ
|
|
76
|
+
" width="200px;margin: 20px 0" alt="Happy"/><br />
|
|
77
|
+
<a href="https://m.habisummercamp.com/" target="_bvlank"><b>HappyMobile
|
|
72
78
|
</b></a></td>
|
|
73
79
|
</tr>
|
|
74
80
|
<tr>
|
|
@@ -82,21 +88,9 @@
|
|
|
82
88
|
</b></sub></a></td>
|
|
83
89
|
<td align="center"><a target="_blank" href="http://tx.ssr-fc.com/"><img src="http://s0.60logo.com/uploads/items/images/soft/180126/tengxunyun.svg" width="100px;"/><br><sub><b>部署于腾讯云示例应用
|
|
84
90
|
</b></sub></a></td>
|
|
85
|
-
<td align="center"><a href="https://www.gszq.com/" target="_blank"><img src="https://www.gszq.com/static/media/icon-slogan.4d1c7974.png
|
|
86
|
-
" width="100px;" alt="国盛证券"/><br />
|
|
87
|
-
<a href="https://www.gszq.com/" target="_bvlank"><sub><b>国盛证券
|
|
88
|
-
</b></a></td>
|
|
89
|
-
<td align="center"><a href="https://m.isle.org.cn" target="_blank"><img src="https://res.wx.qq.com/op_res/qzBjcpT1AZDopDDkEJfj5gKFADotYHTgD33lz9xvZUIj7VJaIR_8HE4lfOxwaiYBgi4V2xXm0xLmAcdQxF4IrQ" width="100px;" alt="三易科技"/><br />
|
|
90
|
-
<a href="https://m.isle.org.cn" target="_bvlank"><sub><b>三易科技
|
|
91
|
-
</b></a></td>
|
|
92
|
-
<td align="center"><a href="https://www.66tools.com/" target="_blank"><img src="https://cdn.66tools.com/extension/chrome_qrcode_avatar.png" width="100px;" alt="极速二维码"/><br />
|
|
93
|
-
<a href="https://www.66tools.com/" target="_bvlank"><sub><b>极速二维码
|
|
94
|
-
</b></a></td>
|
|
95
91
|
<td align="center"><a href="https://www.100.com/" target="_blank"><img src="https://oss.bs2dl.100.com/hippo/config/f13ee98cfca7ce13888752c1261081b44bd356fd.png" width="100px;" alt="100教育"/><br />
|
|
96
92
|
<a href="https://www.100.com/" target="_bvlank"><sub><b>100教育
|
|
97
93
|
</b></a></td>
|
|
98
|
-
</tr>
|
|
99
|
-
<tr>
|
|
100
94
|
<td align="center" style="height: 100px"><a href="https://m.film.qq.com/x/tva-vip-center/" target="_blank"><img src="https://res.wx.qq.com/op_res/x7sWI9AfUK1QwH0EDhKp4e_bGWxYOQ_1RlZqBFy9JntJzaE4aRzNhVgmxLNloAFpSQ-mBr9X9pux3QlV9QHHvQ" width="200px;margin: 20px 0" alt="腾讯视频"/><br />
|
|
101
95
|
<a href="https://m.film.qq.com/x/tva-vip-center/" target="_bvlank"><b>腾讯视频
|
|
102
96
|
</b></a></td>
|
|
@@ -106,17 +100,23 @@
|
|
|
106
100
|
<td align="center" style="height: 100px"><a href="https://jiawu.dewu.com" target="_blank"><img src="https://cdn.poizon.com/node-common/31116a45953ad8b468c6c832036aac88.png" width="200px;margin: 20px 0" alt="Dream2qBlog"/><br />
|
|
107
101
|
<a href="https://jiawu.dewu.com" target="_bvlank"><b>得物
|
|
108
102
|
</b></a></td>
|
|
109
|
-
<td align="center"
|
|
110
|
-
|
|
111
|
-
<a href="https://www.habisummercamp.com/" target="_bvlank"><b>HappyPC
|
|
103
|
+
<td align="center"><a href="https://www.myweimai.com/#sectionOne" target="_blank"><img src="https://img.alicdn.com/tfs/TB16i3VrQT2gK0jSZPcXXcKkpXa-400-400.jpg" width="100px;" alt="微脉"/><br />
|
|
104
|
+
<a href="https://www.myweimai.com/#sectionOne" target="_bvlank"><sub><b>微脉
|
|
112
105
|
</b></a></td>
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
<a href="https://
|
|
106
|
+
</tr>
|
|
107
|
+
<tr>
|
|
108
|
+
<td align="center"><a target="_blank" href="https://campaign.vmate.com/vrbollywood"><img src="https://img.alicdn.com/tfs/TB17p6Vhbj1gK0jSZFOXXc7GpXa-512-512.png" width="100px;" alt="vmate 积分商城"/><br />
|
|
109
|
+
<a target="_blank" href="https://job.alibaba.com/zhaopin/position_detail.htm?trace=qrcode_share&positionCode=GP524819"><sub><b>Vmate短视频
|
|
110
|
+
</b></a></td>
|
|
111
|
+
<td align="center"><a target="_blank" href="https://enjoysales.paat.com/"><img src="https://img.alicdn.com/tfs/TB1Ma0BiEY1gK0jSZFMXXaWcVXa-836-836.png" width="100px;" alt="火炽星原CRM"/><br />
|
|
112
|
+
<a target="_blank" href="https://enjoysales.paat.com/"><sub><b>火炽星原CRM
|
|
116
113
|
</b></a></td>
|
|
117
114
|
<td align="center" style="height: 100px"><a href="https://www.paixin.com/" target="_blank"><img src="https://www.paixin.com/favicon.ico" width="200px;margin: 20px 0" alt="Happy"/><br />
|
|
118
115
|
<a href="https://www.paixin.com/" target="_bvlank"><b>拍信创意
|
|
119
116
|
</b></a></td>
|
|
117
|
+
<td align="center"><a href="https://www.66tools.com/" target="_blank"><img src="https://cdn.66tools.com/extension/chrome_qrcode_avatar.png" width="100px;" alt="极速二维码"/><br />
|
|
118
|
+
<a href="https://www.66tools.com/" target="_bvlank"><sub><b>极速二维码
|
|
119
|
+
</b></a></td>
|
|
120
120
|
</tr>
|
|
121
121
|
</table>
|
|
122
122
|
|
package/cjs/config/base.js
CHANGED
|
@@ -43,7 +43,7 @@ const addBabelLoader = (chain, envOptions) => {
|
|
|
43
43
|
};
|
|
44
44
|
const getBaseConfig = (chain, isServer) => {
|
|
45
45
|
const config = (0, ssr_server_utils_1.loadConfig)();
|
|
46
|
-
const { moduleFileExtensions, useHash, isDev, chainBaseConfig, corejs, babelExtraModule } = config;
|
|
46
|
+
const { moduleFileExtensions, useHash, isDev, chainBaseConfig, corejs, babelExtraModule, alias } = config;
|
|
47
47
|
const mode = process.env.NODE_ENV;
|
|
48
48
|
const envOptions = {
|
|
49
49
|
modules: false
|
|
@@ -72,12 +72,10 @@ const getBaseConfig = (chain, isServer) => {
|
|
|
72
72
|
.end()
|
|
73
73
|
.alias
|
|
74
74
|
.end();
|
|
75
|
-
|
|
76
|
-
.
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
.set('react-router', loadModule('react-router'))
|
|
80
|
-
.set('react-router-dom', loadModule('react-router-dom'));
|
|
75
|
+
alias && Object.keys(alias).forEach(item => {
|
|
76
|
+
chain.resolve.alias
|
|
77
|
+
.set(item, alias[item]);
|
|
78
|
+
});
|
|
81
79
|
(0, ssr_server_utils_1.addImageChain)(chain, isServer);
|
|
82
80
|
const babelModule = chain.module
|
|
83
81
|
.rule('compileBabel')
|
package/cjs/tools/vite.js
CHANGED
|
@@ -6,7 +6,7 @@ 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 } = (0, ssr_server_utils_1.loadConfig)();
|
|
9
|
+
const { getOutput, reactServerEntry, reactClientEntry, viteConfig, isCI } = (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/],
|
|
@@ -23,7 +23,13 @@ const serverConfig = {
|
|
|
23
23
|
plugins: [
|
|
24
24
|
(0, plugin_react_1.default)({
|
|
25
25
|
...(_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
|
-
jsxRuntime: 'classic'
|
|
26
|
+
jsxRuntime: 'classic',
|
|
27
|
+
babel: isCI && {
|
|
28
|
+
plugins: [
|
|
29
|
+
'@babel/plugin-proposal-optional-chaining',
|
|
30
|
+
'@babel/plugin-proposal-nullish-coalescing-operator'
|
|
31
|
+
]
|
|
32
|
+
}
|
|
27
33
|
}),
|
|
28
34
|
(_d = (_c = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _c === void 0 ? void 0 : _c.server) === null || _d === void 0 ? void 0 : _d.extraPlugin,
|
|
29
35
|
(0, vite_plugin_style_import_1.default)(styleImportConfig)
|
package/esm/config/base.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { join } from 'path';
|
|
2
|
-
import {
|
|
2
|
+
import { getCwd, loadConfig, getLocalNodeModules, setStyle, addImageChain } from 'ssr-server-utils';
|
|
3
3
|
import * as webpack from 'webpack';
|
|
4
4
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
5
5
|
const WebpackBar = require('webpackbar');
|
|
@@ -40,7 +40,7 @@ const addBabelLoader = (chain, envOptions) => {
|
|
|
40
40
|
};
|
|
41
41
|
const getBaseConfig = (chain, isServer) => {
|
|
42
42
|
const config = loadConfig();
|
|
43
|
-
const { moduleFileExtensions, useHash, isDev, chainBaseConfig, corejs, babelExtraModule } = config;
|
|
43
|
+
const { moduleFileExtensions, useHash, isDev, chainBaseConfig, corejs, babelExtraModule, alias } = config;
|
|
44
44
|
const mode = process.env.NODE_ENV;
|
|
45
45
|
const envOptions = {
|
|
46
46
|
modules: false
|
|
@@ -69,12 +69,10 @@ const getBaseConfig = (chain, isServer) => {
|
|
|
69
69
|
.end()
|
|
70
70
|
.alias
|
|
71
71
|
.end();
|
|
72
|
-
|
|
73
|
-
.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
.set('react-router', loadModule('react-router'))
|
|
77
|
-
.set('react-router-dom', loadModule('react-router-dom'));
|
|
72
|
+
alias && Object.keys(alias).forEach(item => {
|
|
73
|
+
chain.resolve.alias
|
|
74
|
+
.set(item, alias[item]);
|
|
75
|
+
});
|
|
78
76
|
addImageChain(chain, isServer);
|
|
79
77
|
const babelModule = chain.module
|
|
80
78
|
.rule('compileBabel')
|
package/esm/tools/vite.js
CHANGED
|
@@ -3,7 +3,7 @@ import { loadConfig, chunkNamePlugin, rollupOutputOptions, manifestPlugin, commo
|
|
|
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 } = loadConfig();
|
|
6
|
+
const { getOutput, reactServerEntry, reactClientEntry, viteConfig, isCI } = loadConfig();
|
|
7
7
|
const { clientOutPut, serverOutPut } = getOutput();
|
|
8
8
|
const styleImportConfig = {
|
|
9
9
|
include: ['**/*.vue', '**/*.ts', '**/*.js', '**/*.tsx', '**/*.jsx', /chunkName/],
|
|
@@ -20,7 +20,13 @@ const serverConfig = {
|
|
|
20
20
|
plugins: [
|
|
21
21
|
react({
|
|
22
22
|
...(_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
|
-
jsxRuntime: 'classic'
|
|
23
|
+
jsxRuntime: 'classic',
|
|
24
|
+
babel: isCI && {
|
|
25
|
+
plugins: [
|
|
26
|
+
'@babel/plugin-proposal-optional-chaining',
|
|
27
|
+
'@babel/plugin-proposal-nullish-coalescing-operator'
|
|
28
|
+
]
|
|
29
|
+
}
|
|
24
30
|
}),
|
|
25
31
|
(_d = (_c = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _c === void 0 ? void 0 : _c.server) === null || _d === void 0 ? void 0 : _d.extraPlugin,
|
|
26
32
|
styleImport(styleImportConfig)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ssr-plugin-react",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.25",
|
|
4
4
|
"description": "plugin-react for ssr",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -30,6 +30,8 @@
|
|
|
30
30
|
"homepage": "https://github.com/zhangyuang/ssr#readme",
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@babel/core": "^7.0.0",
|
|
33
|
+
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.5",
|
|
34
|
+
"@babel/plugin-proposal-optional-chaining": "^7.16.5",
|
|
33
35
|
"@babel/plugin-transform-runtime": "^7.9.6",
|
|
34
36
|
"@babel/preset-env": "^7.5.5",
|
|
35
37
|
"@vitejs/plugin-react": "^1.0.0",
|
|
@@ -54,13 +56,13 @@
|
|
|
54
56
|
"postcss-safe-parser": "4.0.1",
|
|
55
57
|
"react-dev-utils": "^11.0.4",
|
|
56
58
|
"serialize-javascript": "^6.0.0",
|
|
57
|
-
"ssr-client-utils": "^6.1.
|
|
58
|
-
"ssr-hoc-react": "^6.1.
|
|
59
|
-
"ssr-server-utils": "^6.1.
|
|
60
|
-
"ssr-webpack": "^6.1.
|
|
59
|
+
"ssr-client-utils": "^6.1.25",
|
|
60
|
+
"ssr-hoc-react": "^6.1.25",
|
|
61
|
+
"ssr-server-utils": "^6.1.25",
|
|
62
|
+
"ssr-webpack": "^6.1.25",
|
|
61
63
|
"terser-webpack-plugin": "^2.3.5",
|
|
62
64
|
"url-loader": "^4.1.1",
|
|
63
|
-
"vite": "^2.7.0
|
|
65
|
+
"vite": "^2.7.0",
|
|
64
66
|
"vite-plugin-style-import": "^1.4.0",
|
|
65
67
|
"webpack-bundle-analyzer": "^3.6.1",
|
|
66
68
|
"webpack-chain": "^6.4.0",
|
|
@@ -72,7 +74,7 @@
|
|
|
72
74
|
"@types/react-dom": "^17.0.0",
|
|
73
75
|
"@types/react-router-dom": "^5.1.3",
|
|
74
76
|
"@types/webpack": "^4.41.10",
|
|
75
|
-
"ssr-types-react": "^6.1.
|
|
77
|
+
"ssr-types-react": "^6.1.25"
|
|
76
78
|
},
|
|
77
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "7a1a65d728c7a91bd80a2d782ed259b4649bae63"
|
|
78
80
|
}
|
package/src/config/base.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import { join } from 'path'
|
|
3
3
|
import { Mode } from 'ssr-types'
|
|
4
|
-
import {
|
|
4
|
+
import { getCwd, loadConfig, getLocalNodeModules, setStyle, addImageChain } from 'ssr-server-utils'
|
|
5
5
|
import * as WebpackChain from 'webpack-chain'
|
|
6
6
|
import * as webpack from 'webpack'
|
|
7
7
|
|
|
@@ -45,7 +45,7 @@ const addBabelLoader = (chain: WebpackChain.Rule<WebpackChain.Module>, envOption
|
|
|
45
45
|
}
|
|
46
46
|
const getBaseConfig = (chain: WebpackChain, isServer: boolean) => {
|
|
47
47
|
const config = loadConfig()
|
|
48
|
-
const { moduleFileExtensions, useHash, isDev, chainBaseConfig, corejs, babelExtraModule } = config
|
|
48
|
+
const { moduleFileExtensions, useHash, isDev, chainBaseConfig, corejs, babelExtraModule, alias } = config
|
|
49
49
|
const mode = process.env.NODE_ENV as Mode
|
|
50
50
|
const envOptions = {
|
|
51
51
|
modules: false
|
|
@@ -75,12 +75,11 @@ const getBaseConfig = (chain: WebpackChain, isServer: boolean) => {
|
|
|
75
75
|
.end()
|
|
76
76
|
.alias
|
|
77
77
|
.end()
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
.
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
.set('react-router-dom', loadModule('react-router-dom'))
|
|
78
|
+
|
|
79
|
+
alias && Object.keys(alias).forEach(item => {
|
|
80
|
+
chain.resolve.alias
|
|
81
|
+
.set(item, alias[item])
|
|
82
|
+
})
|
|
84
83
|
|
|
85
84
|
addImageChain(chain, isServer)
|
|
86
85
|
|
package/src/tools/vite.ts
CHANGED
|
@@ -10,7 +10,7 @@ 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 } = loadConfig()
|
|
13
|
+
const { getOutput, reactServerEntry, reactClientEntry, viteConfig, isCI } = loadConfig()
|
|
14
14
|
const { clientOutPut, serverOutPut } = getOutput()
|
|
15
15
|
const styleImportConfig = {
|
|
16
16
|
include: ['**/*.vue', '**/*.ts', '**/*.js', '**/*.tsx', '**/*.jsx', /chunkName/],
|
|
@@ -19,18 +19,24 @@ const styleImportConfig = {
|
|
|
19
19
|
VantResolve(),
|
|
20
20
|
ElementPlusResolve(),
|
|
21
21
|
NutuiResolve(),
|
|
22
|
-
AntdResolve()
|
|
22
|
+
AntdResolve()
|
|
23
|
+
]
|
|
23
24
|
}
|
|
24
25
|
const serverConfig: UserConfig = {
|
|
25
26
|
...commonConfig(),
|
|
26
27
|
plugins: [
|
|
27
28
|
react({
|
|
28
29
|
...viteConfig?.()?.server?.defaultPluginOptions,
|
|
29
|
-
jsxRuntime: 'classic'
|
|
30
|
+
jsxRuntime: 'classic',
|
|
31
|
+
babel: isCI && {
|
|
32
|
+
plugins: [
|
|
33
|
+
'@babel/plugin-proposal-optional-chaining',
|
|
34
|
+
'@babel/plugin-proposal-nullish-coalescing-operator'
|
|
35
|
+
]
|
|
36
|
+
}
|
|
30
37
|
}),
|
|
31
38
|
viteConfig?.()?.server?.extraPlugin,
|
|
32
39
|
styleImport(styleImportConfig)
|
|
33
|
-
|
|
34
40
|
],
|
|
35
41
|
build: {
|
|
36
42
|
ssr: reactServerEntry,
|