ssr-plugin-react 6.1.37 → 6.1.41
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 +35 -0
- package/cjs/config/base.js +5 -13
- package/cjs/config/client.js +2 -2
- package/cjs/config/server.js +1 -2
- package/esm/config/base.js +6 -14
- package/esm/config/client.js +3 -3
- package/esm/config/server.js +1 -2
- package/package.json +7 -7
- package/src/config/base.ts +6 -14
- package/src/config/client.ts +3 -3
- package/src/config/server.ts +1 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,41 @@
|
|
|
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.41](https://github.com/zhangyuang/ssr/compare/v6.1.40...v6.1.41) (2022-01-05)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package ssr-plugin-react
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [6.1.40](https://github.com/zhangyuang/ssr/compare/v6.1.39...v6.1.40) (2022-01-04)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package ssr-plugin-react
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [6.1.39](https://github.com/zhangyuang/ssr/compare/v6.1.38...v6.1.39) (2021-12-31)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package ssr-plugin-react
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## [6.1.38](https://github.com/zhangyuang/ssr/compare/v6.1.37...v6.1.38) (2021-12-31)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Features
|
|
34
|
+
|
|
35
|
+
* better corejsOptions ([732a5ce](https://github.com/zhangyuang/ssr/commit/732a5ce3a60797e4fea564f5994650f9383ef98d))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
6
41
|
## [6.1.37](https://github.com/zhangyuang/ssr/compare/v6.1.36...v6.1.37) (2021-12-30)
|
|
7
42
|
|
|
8
43
|
**Note:** Version bump only for package ssr-plugin-react
|
package/cjs/config/base.js
CHANGED
|
@@ -4,9 +4,9 @@ exports.getBaseConfig = void 0;
|
|
|
4
4
|
const path_1 = require("path");
|
|
5
5
|
const ssr_server_utils_1 = require("ssr-server-utils");
|
|
6
6
|
const webpack = require("webpack");
|
|
7
|
-
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
7
|
+
const MiniCssExtractPlugin = require((0, ssr_server_utils_1.loadModuleFromFramework)('mini-css-extract-plugin'));
|
|
8
8
|
const WebpackBar = require('webpackbar');
|
|
9
|
-
const loadModule =
|
|
9
|
+
const loadModule = ssr_server_utils_1.loadModuleFromFramework;
|
|
10
10
|
const addBabelLoader = (chain, envOptions) => {
|
|
11
11
|
chain.use('babel-loader')
|
|
12
12
|
.loader(loadModule('babel-loader'))
|
|
@@ -43,20 +43,12 @@ 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,
|
|
46
|
+
const { moduleFileExtensions, useHash, isDev, chainBaseConfig, corejsOptions, babelExtraModule, alias } = config;
|
|
47
47
|
const mode = process.env.NODE_ENV;
|
|
48
48
|
const envOptions = {
|
|
49
|
-
modules: false
|
|
49
|
+
modules: false,
|
|
50
|
+
...corejsOptions
|
|
50
51
|
};
|
|
51
|
-
if (corejs) {
|
|
52
|
-
Object.assign(envOptions, {
|
|
53
|
-
corejs: {
|
|
54
|
-
version: 3,
|
|
55
|
-
proposals: true
|
|
56
|
-
},
|
|
57
|
-
useBuiltIns: 'usage'
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
52
|
chain.mode(mode);
|
|
61
53
|
chain.module.strictExportPresence(true);
|
|
62
54
|
chain
|
package/cjs/config/client.js
CHANGED
|
@@ -9,7 +9,7 @@ const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin');
|
|
|
9
9
|
const safePostCssParser = require('postcss-safe-parser');
|
|
10
10
|
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
|
11
11
|
const generateAnalysis = Boolean(process.env.GENERATE_ANALYSIS);
|
|
12
|
-
const loadModule =
|
|
12
|
+
const loadModule = ssr_server_utils_1.loadModuleFromFramework;
|
|
13
13
|
let asyncChunkMap = {};
|
|
14
14
|
const getClientWebpack = (chain) => {
|
|
15
15
|
const { isDev, chunkName, getOutput, cwd, useHash, chainClientConfig } = (0, ssr_server_utils_1.loadConfig)();
|
|
@@ -18,7 +18,7 @@ const getClientWebpack = (chain) => {
|
|
|
18
18
|
(0, base_1.getBaseConfig)(chain, false);
|
|
19
19
|
chain.devtool(isDev ? 'cheap-module-source-map' : (shouldUseSourceMap ? 'source-map' : false));
|
|
20
20
|
chain.entry(chunkName)
|
|
21
|
-
.add(
|
|
21
|
+
.add(require.resolve('../entry/client-entry'))
|
|
22
22
|
.end()
|
|
23
23
|
.output
|
|
24
24
|
.path(getOutput().clientOutPut)
|
package/cjs/config/server.js
CHANGED
|
@@ -5,7 +5,6 @@ const path_1 = require("path");
|
|
|
5
5
|
const ssr_server_utils_1 = require("ssr-server-utils");
|
|
6
6
|
const webpack = require("webpack");
|
|
7
7
|
const base_1 = require("./base");
|
|
8
|
-
const loadModule = require.resolve;
|
|
9
8
|
const getServerWebpack = (chain) => {
|
|
10
9
|
const config = (0, ssr_server_utils_1.loadConfig)();
|
|
11
10
|
const { isDev, cwd, getOutput, chainServerConfig, whiteList, chunkName } = config;
|
|
@@ -13,7 +12,7 @@ const getServerWebpack = (chain) => {
|
|
|
13
12
|
chain.devtool(isDev ? 'inline-source-map' : false);
|
|
14
13
|
chain.target('node');
|
|
15
14
|
chain.entry(chunkName)
|
|
16
|
-
.add(
|
|
15
|
+
.add(require.resolve('../entry/server-entry'))
|
|
17
16
|
.end()
|
|
18
17
|
.output
|
|
19
18
|
.path(getOutput().serverOutPut)
|
package/esm/config/base.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { join } from 'path';
|
|
2
|
-
import { getCwd, loadConfig, getLocalNodeModules, setStyle, addImageChain } from 'ssr-server-utils';
|
|
2
|
+
import { getCwd, loadConfig, getLocalNodeModules, setStyle, addImageChain, loadModuleFromFramework } from 'ssr-server-utils';
|
|
3
3
|
import * as webpack from 'webpack';
|
|
4
|
-
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
4
|
+
const MiniCssExtractPlugin = require(loadModuleFromFramework('mini-css-extract-plugin'));
|
|
5
5
|
const WebpackBar = require('webpackbar');
|
|
6
|
-
const loadModule =
|
|
6
|
+
const loadModule = loadModuleFromFramework;
|
|
7
7
|
const addBabelLoader = (chain, envOptions) => {
|
|
8
8
|
chain.use('babel-loader')
|
|
9
9
|
.loader(loadModule('babel-loader'))
|
|
@@ -40,20 +40,12 @@ const addBabelLoader = (chain, envOptions) => {
|
|
|
40
40
|
};
|
|
41
41
|
const getBaseConfig = (chain, isServer) => {
|
|
42
42
|
const config = loadConfig();
|
|
43
|
-
const { moduleFileExtensions, useHash, isDev, chainBaseConfig,
|
|
43
|
+
const { moduleFileExtensions, useHash, isDev, chainBaseConfig, corejsOptions, babelExtraModule, alias } = config;
|
|
44
44
|
const mode = process.env.NODE_ENV;
|
|
45
45
|
const envOptions = {
|
|
46
|
-
modules: false
|
|
46
|
+
modules: false,
|
|
47
|
+
...corejsOptions
|
|
47
48
|
};
|
|
48
|
-
if (corejs) {
|
|
49
|
-
Object.assign(envOptions, {
|
|
50
|
-
corejs: {
|
|
51
|
-
version: 3,
|
|
52
|
-
proposals: true
|
|
53
|
-
},
|
|
54
|
-
useBuiltIns: 'usage'
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
49
|
chain.mode(mode);
|
|
58
50
|
chain.module.strictExportPresence(true);
|
|
59
51
|
chain
|
package/esm/config/client.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { promises } from 'fs';
|
|
2
2
|
import { resolve } from 'path';
|
|
3
|
-
import { loadConfig, getCwd, cryptoAsyncChunkName, getOutputPublicPath } from 'ssr-server-utils';
|
|
3
|
+
import { loadConfig, getCwd, cryptoAsyncChunkName, getOutputPublicPath, loadModuleFromFramework } from 'ssr-server-utils';
|
|
4
4
|
import { getBaseConfig } from './base';
|
|
5
5
|
const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin');
|
|
6
6
|
const safePostCssParser = require('postcss-safe-parser');
|
|
7
7
|
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
|
8
8
|
const generateAnalysis = Boolean(process.env.GENERATE_ANALYSIS);
|
|
9
|
-
const loadModule =
|
|
9
|
+
const loadModule = loadModuleFromFramework;
|
|
10
10
|
let asyncChunkMap = {};
|
|
11
11
|
const getClientWebpack = (chain) => {
|
|
12
12
|
const { isDev, chunkName, getOutput, cwd, useHash, chainClientConfig } = loadConfig();
|
|
@@ -15,7 +15,7 @@ const getClientWebpack = (chain) => {
|
|
|
15
15
|
getBaseConfig(chain, false);
|
|
16
16
|
chain.devtool(isDev ? 'cheap-module-source-map' : (shouldUseSourceMap ? 'source-map' : false));
|
|
17
17
|
chain.entry(chunkName)
|
|
18
|
-
.add(
|
|
18
|
+
.add(require.resolve('../entry/client-entry'))
|
|
19
19
|
.end()
|
|
20
20
|
.output
|
|
21
21
|
.path(getOutput().clientOutPut)
|
package/esm/config/server.js
CHANGED
|
@@ -2,7 +2,6 @@ import { join } from 'path';
|
|
|
2
2
|
import { loadConfig, getLocalNodeModules, nodeExternals } from 'ssr-server-utils';
|
|
3
3
|
import * as webpack from 'webpack';
|
|
4
4
|
import { getBaseConfig } from './base';
|
|
5
|
-
const loadModule = require.resolve;
|
|
6
5
|
const getServerWebpack = (chain) => {
|
|
7
6
|
const config = loadConfig();
|
|
8
7
|
const { isDev, cwd, getOutput, chainServerConfig, whiteList, chunkName } = config;
|
|
@@ -10,7 +9,7 @@ const getServerWebpack = (chain) => {
|
|
|
10
9
|
chain.devtool(isDev ? 'inline-source-map' : false);
|
|
11
10
|
chain.target('node');
|
|
12
11
|
chain.entry(chunkName)
|
|
13
|
-
.add(
|
|
12
|
+
.add(require.resolve('../entry/server-entry'))
|
|
14
13
|
.end()
|
|
15
14
|
.output
|
|
16
15
|
.path(getOutput().serverOutPut)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ssr-plugin-react",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.41",
|
|
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.38",
|
|
60
|
+
"ssr-hoc-react": "^6.1.38",
|
|
61
|
+
"ssr-server-utils": "^6.1.41",
|
|
62
|
+
"ssr-webpack": "^6.1.41",
|
|
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.38"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "281da0c4727326b724bf85bf174701734fee83ce"
|
|
80
80
|
}
|
package/src/config/base.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
|
|
2
2
|
import { join } from 'path'
|
|
3
3
|
import { Mode } from 'ssr-types'
|
|
4
|
-
import { getCwd, loadConfig, getLocalNodeModules, setStyle, addImageChain } from 'ssr-server-utils'
|
|
4
|
+
import { getCwd, loadConfig, getLocalNodeModules, setStyle, addImageChain, loadModuleFromFramework } from 'ssr-server-utils'
|
|
5
5
|
import * as WebpackChain from 'webpack-chain'
|
|
6
6
|
import * as webpack from 'webpack'
|
|
7
7
|
|
|
8
|
-
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
|
8
|
+
const MiniCssExtractPlugin = require(loadModuleFromFramework('mini-css-extract-plugin'))
|
|
9
9
|
const WebpackBar = require('webpackbar')
|
|
10
|
-
const loadModule =
|
|
10
|
+
const loadModule = loadModuleFromFramework
|
|
11
11
|
|
|
12
12
|
const addBabelLoader = (chain: WebpackChain.Rule<WebpackChain.Module>, envOptions: any) => {
|
|
13
13
|
chain.use('babel-loader')
|
|
@@ -45,21 +45,13 @@ 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,
|
|
48
|
+
const { moduleFileExtensions, useHash, isDev, chainBaseConfig, corejsOptions, babelExtraModule, alias } = config
|
|
49
49
|
const mode = process.env.NODE_ENV as Mode
|
|
50
50
|
const envOptions = {
|
|
51
|
-
modules: false
|
|
51
|
+
modules: false,
|
|
52
|
+
...corejsOptions
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
if (corejs) {
|
|
55
|
-
Object.assign(envOptions, {
|
|
56
|
-
corejs: {
|
|
57
|
-
version: 3,
|
|
58
|
-
proposals: true
|
|
59
|
-
},
|
|
60
|
-
useBuiltIns: 'usage'
|
|
61
|
-
})
|
|
62
|
-
}
|
|
63
55
|
chain.mode(mode)
|
|
64
56
|
chain.module.strictExportPresence(true)
|
|
65
57
|
chain
|
package/src/config/client.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { promises } from 'fs'
|
|
2
2
|
import { resolve } from 'path'
|
|
3
|
-
import { loadConfig, getCwd, cryptoAsyncChunkName, getOutputPublicPath } from 'ssr-server-utils'
|
|
3
|
+
import { loadConfig, getCwd, cryptoAsyncChunkName, getOutputPublicPath, loadModuleFromFramework } from 'ssr-server-utils'
|
|
4
4
|
import * as WebpackChain from 'webpack-chain'
|
|
5
5
|
import { getBaseConfig } from './base'
|
|
6
6
|
|
|
@@ -8,7 +8,7 @@ const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin')
|
|
|
8
8
|
const safePostCssParser = require('postcss-safe-parser')
|
|
9
9
|
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
|
|
10
10
|
const generateAnalysis = Boolean(process.env.GENERATE_ANALYSIS)
|
|
11
|
-
const loadModule =
|
|
11
|
+
const loadModule = loadModuleFromFramework
|
|
12
12
|
let asyncChunkMap: Record<string, string> = {}
|
|
13
13
|
|
|
14
14
|
const getClientWebpack = (chain: WebpackChain) => {
|
|
@@ -18,7 +18,7 @@ const getClientWebpack = (chain: WebpackChain) => {
|
|
|
18
18
|
getBaseConfig(chain, false)
|
|
19
19
|
chain.devtool(isDev ? 'cheap-module-source-map' : (shouldUseSourceMap ? 'source-map' : false))
|
|
20
20
|
chain.entry(chunkName)
|
|
21
|
-
.add(
|
|
21
|
+
.add(require.resolve('../entry/client-entry'))
|
|
22
22
|
.end()
|
|
23
23
|
.output
|
|
24
24
|
.path(getOutput().clientOutPut)
|
package/src/config/server.ts
CHANGED
|
@@ -4,8 +4,6 @@ import * as WebpackChain from 'webpack-chain'
|
|
|
4
4
|
import * as webpack from 'webpack'
|
|
5
5
|
import { getBaseConfig } from './base'
|
|
6
6
|
|
|
7
|
-
const loadModule = require.resolve
|
|
8
|
-
|
|
9
7
|
const getServerWebpack = (chain: WebpackChain) => {
|
|
10
8
|
const config = loadConfig()
|
|
11
9
|
const { isDev, cwd, getOutput, chainServerConfig, whiteList, chunkName } = config
|
|
@@ -13,7 +11,7 @@ const getServerWebpack = (chain: WebpackChain) => {
|
|
|
13
11
|
chain.devtool(isDev ? 'inline-source-map' : false)
|
|
14
12
|
chain.target('node')
|
|
15
13
|
chain.entry(chunkName)
|
|
16
|
-
.add(
|
|
14
|
+
.add(require.resolve('../entry/server-entry'))
|
|
17
15
|
.end()
|
|
18
16
|
.output
|
|
19
17
|
.path(getOutput().serverOutPut)
|