ssr-plugin-react 6.1.41 → 6.1.42
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 +11 -0
- package/cjs/config/base.js +4 -2
- package/cjs/tools/vite.js +7 -3
- package/esm/config/base.js +4 -2
- package/esm/tools/vite.js +7 -3
- package/package.json +7 -7
- package/src/config/base.ts +4 -2
- package/src/tools/vite.ts +7 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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.42](https://github.com/zhangyuang/ssr/compare/v6.1.41...v6.1.42) (2022-01-05)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* support config.define ([c04f128](https://github.com/zhangyuang/ssr/commit/c04f12844e22300f57e17683cff0584e8f8ea123))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [6.1.41](https://github.com/zhangyuang/ssr/compare/v6.1.40...v6.1.41) (2022-01-05)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package ssr-plugin-react
|
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, corejsOptions, babelExtraModule, alias } = config;
|
|
46
|
+
const { moduleFileExtensions, useHash, isDev, chainBaseConfig, corejsOptions, babelExtraModule, alias, define } = config;
|
|
47
47
|
const mode = process.env.NODE_ENV;
|
|
48
48
|
const envOptions = {
|
|
49
49
|
modules: false,
|
|
@@ -119,7 +119,9 @@ const getBaseConfig = (chain, isServer) => {
|
|
|
119
119
|
color: isServer ? '#f173ac' : '#45b97c'
|
|
120
120
|
}));
|
|
121
121
|
chain.plugin('ssrDefine').use(webpack.DefinePlugin, [{
|
|
122
|
-
__isBrowser__: !isServer
|
|
122
|
+
__isBrowser__: !isServer,
|
|
123
|
+
...(isServer ? define === null || define === void 0 ? void 0 : define.server : define === null || define === void 0 ? void 0 : define.client),
|
|
124
|
+
...define === null || define === void 0 ? void 0 : define.base
|
|
123
125
|
}]);
|
|
124
126
|
chainBaseConfig(chain);
|
|
125
127
|
return config;
|
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, supportOptinalChaining, isDev } = (0, ssr_server_utils_1.loadConfig)();
|
|
9
|
+
const { getOutput, reactServerEntry, reactClientEntry, viteConfig, supportOptinalChaining, isDev, define } = (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/],
|
|
@@ -47,7 +47,9 @@ const serverConfig = {
|
|
|
47
47
|
},
|
|
48
48
|
define: {
|
|
49
49
|
__isBrowser__: false,
|
|
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
|
|
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,
|
|
51
|
+
...define === null || define === void 0 ? void 0 : define.server,
|
|
52
|
+
...define === null || define === void 0 ? void 0 : define.base
|
|
51
53
|
}
|
|
52
54
|
};
|
|
53
55
|
exports.serverConfig = serverConfig;
|
|
@@ -76,7 +78,9 @@ const clientConfig = {
|
|
|
76
78
|
},
|
|
77
79
|
define: {
|
|
78
80
|
__isBrowser__: true,
|
|
79
|
-
...(_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
|
|
81
|
+
...(_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,
|
|
82
|
+
...define === null || define === void 0 ? void 0 : define.client,
|
|
83
|
+
...define === null || define === void 0 ? void 0 : define.base
|
|
80
84
|
}
|
|
81
85
|
};
|
|
82
86
|
exports.clientConfig = clientConfig;
|
package/esm/config/base.js
CHANGED
|
@@ -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, corejsOptions, babelExtraModule, alias } = config;
|
|
43
|
+
const { moduleFileExtensions, useHash, isDev, chainBaseConfig, corejsOptions, babelExtraModule, alias, define } = config;
|
|
44
44
|
const mode = process.env.NODE_ENV;
|
|
45
45
|
const envOptions = {
|
|
46
46
|
modules: false,
|
|
@@ -116,7 +116,9 @@ const getBaseConfig = (chain, isServer) => {
|
|
|
116
116
|
color: isServer ? '#f173ac' : '#45b97c'
|
|
117
117
|
}));
|
|
118
118
|
chain.plugin('ssrDefine').use(webpack.DefinePlugin, [{
|
|
119
|
-
__isBrowser__: !isServer
|
|
119
|
+
__isBrowser__: !isServer,
|
|
120
|
+
...(isServer ? define === null || define === void 0 ? void 0 : define.server : define === null || define === void 0 ? void 0 : define.client),
|
|
121
|
+
...define === null || define === void 0 ? void 0 : define.base
|
|
120
122
|
}]);
|
|
121
123
|
chainBaseConfig(chain);
|
|
122
124
|
return config;
|
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, supportOptinalChaining, isDev } = loadConfig();
|
|
6
|
+
const { getOutput, reactServerEntry, reactClientEntry, viteConfig, supportOptinalChaining, isDev, define } = loadConfig();
|
|
7
7
|
const { clientOutPut, serverOutPut } = getOutput();
|
|
8
8
|
const styleImportConfig = {
|
|
9
9
|
include: ['**/*.vue', '**/*.ts', '**/*.js', '**/*.tsx', '**/*.jsx', /chunkName/],
|
|
@@ -44,7 +44,9 @@ const serverConfig = {
|
|
|
44
44
|
},
|
|
45
45
|
define: {
|
|
46
46
|
__isBrowser__: false,
|
|
47
|
-
...(_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
|
|
47
|
+
...(_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,
|
|
48
|
+
...define === null || define === void 0 ? void 0 : define.server,
|
|
49
|
+
...define === null || define === void 0 ? void 0 : define.base
|
|
48
50
|
}
|
|
49
51
|
};
|
|
50
52
|
const clientConfig = {
|
|
@@ -72,7 +74,9 @@ const clientConfig = {
|
|
|
72
74
|
},
|
|
73
75
|
define: {
|
|
74
76
|
__isBrowser__: true,
|
|
75
|
-
...(_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
|
+
...(_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,
|
|
78
|
+
...define === null || define === void 0 ? void 0 : define.client,
|
|
79
|
+
...define === null || define === void 0 ? void 0 : define.base
|
|
76
80
|
}
|
|
77
81
|
};
|
|
78
82
|
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.42",
|
|
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.42",
|
|
60
|
+
"ssr-hoc-react": "^6.1.42",
|
|
61
|
+
"ssr-server-utils": "^6.1.42",
|
|
62
|
+
"ssr-webpack": "^6.1.42",
|
|
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.42"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "3426bffd013456e7b72ba73f1f04a9a73855bc27"
|
|
80
80
|
}
|
package/src/config/base.ts
CHANGED
|
@@ -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, corejsOptions, babelExtraModule, alias } = config
|
|
48
|
+
const { moduleFileExtensions, useHash, isDev, chainBaseConfig, corejsOptions, babelExtraModule, alias, define } = config
|
|
49
49
|
const mode = process.env.NODE_ENV as Mode
|
|
50
50
|
const envOptions = {
|
|
51
51
|
modules: false,
|
|
@@ -132,7 +132,9 @@ const getBaseConfig = (chain: WebpackChain, isServer: boolean) => {
|
|
|
132
132
|
color: isServer ? '#f173ac' : '#45b97c'
|
|
133
133
|
}))
|
|
134
134
|
chain.plugin('ssrDefine').use(webpack.DefinePlugin, [{
|
|
135
|
-
__isBrowser__: !isServer
|
|
135
|
+
__isBrowser__: !isServer,
|
|
136
|
+
...(isServer ? define?.server : define?.client),
|
|
137
|
+
...define?.base
|
|
136
138
|
}])
|
|
137
139
|
chainBaseConfig(chain)
|
|
138
140
|
return config
|
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, supportOptinalChaining, isDev } = loadConfig()
|
|
13
|
+
const { getOutput, reactServerEntry, reactClientEntry, viteConfig, supportOptinalChaining, isDev, define } = loadConfig()
|
|
14
14
|
|
|
15
15
|
const { clientOutPut, serverOutPut } = getOutput()
|
|
16
16
|
const styleImportConfig = {
|
|
@@ -52,7 +52,9 @@ const serverConfig: UserConfig = {
|
|
|
52
52
|
},
|
|
53
53
|
define: {
|
|
54
54
|
__isBrowser__: false,
|
|
55
|
-
...viteConfig?.()?.server?.define
|
|
55
|
+
...viteConfig?.()?.server?.define,
|
|
56
|
+
...define?.server,
|
|
57
|
+
...define?.base
|
|
56
58
|
}
|
|
57
59
|
}
|
|
58
60
|
|
|
@@ -81,7 +83,9 @@ const clientConfig: UserConfig = {
|
|
|
81
83
|
},
|
|
82
84
|
define: {
|
|
83
85
|
__isBrowser__: true,
|
|
84
|
-
...viteConfig?.()?.client?.define
|
|
86
|
+
...viteConfig?.()?.client?.define,
|
|
87
|
+
...define?.client,
|
|
88
|
+
...define?.base
|
|
85
89
|
}
|
|
86
90
|
}
|
|
87
91
|
const viteStart = async () => {
|