ssr-plugin-react 6.1.48 → 6.1.49

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 CHANGED
@@ -3,6 +3,22 @@
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.49](https://github.com/zhangyuang/ssr/compare/v6.1.48...v6.1.49) (2022-01-19)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * babelExtraModule ([503f3e6](https://github.com/zhangyuang/ssr/commit/503f3e618a8918fbd482267349059d743af75787))
12
+
13
+
14
+ ### Features
15
+
16
+ * vite mode support extract children common module chunks ([4896c6c](https://github.com/zhangyuang/ssr/commit/4896c6cde8e39238f7d34183698acb480f2be9b6))
17
+
18
+
19
+
20
+
21
+
6
22
  ## [6.1.48](https://github.com/zhangyuang/ssr/compare/v6.1.47...v6.1.48) (2022-01-13)
7
23
 
8
24
  **Note:** Version bump only for package ssr-plugin-react
package/README.md CHANGED
@@ -13,12 +13,11 @@
13
13
  </div>
14
14
  <br />
15
15
  <div align="center">
16
- <a href="https://github.com/zhangyuang/ssr/actions" target="_blank"><img src="https://github.com/zhangyuang/ssr/workflows/CI/badge.svg" alt="githubActions"></a>
17
- <a href="https://www.cypress.io/" target="_blank"><img src="https://img.shields.io/badge/cypress-dashboard-brightgreen.svg" alt="cypress"></a>
18
- <a href="https://npmcharts.com/compare/ssr" target="_blank"><img src="https://img.shields.io/npm/dm/ssr" alt="download"></a>
19
- <a href="https://standardjs.com" target="_blank"><img src="https://img.shields.io/badge/code_style-standard-brightgreen.svg" alt="standardjs"></a>
20
- <a href="https://github.com/zhangyuang/ssr" target="_blank"><img src="https://img.shields.io/npm/l/vue.svg" alt="License"></a>
21
- <a href="https://github.com/zhangyuang/ssr" target="_blank"><img src="https://img.shields.io/badge/node-%3E=12-green.svg" alt="Node"></a>
16
+ <a href="https://github.com/zhangyuang/ssr/actions" target="_blank"><img src="https://github.com/zhangyuang/ssr/workflows/CI/badge.svg" alt="githubActions" />
17
+ <a href="https://www.cypress.io/" target="_blank"><img src="https://img.shields.io/badge/cypress-dashboard-brightgreen.svg" alt="cypress" />
18
+ <a href="https://npmcharts.com/compare/ssr" target="_blank"><img src="https://img.shields.io/npm/dm/ssr" alt="download" />
19
+ <a href="https://github.com/zhangyuang/ssr" target="_blank"><img src="https://img.shields.io/tokei/lines/github/zhangyuang/ssr-lines?color=97b93b" alt="Node" />
20
+ <a href="https://github.com/zhangyuang/ssr" target="_blank"><img src="https://img.shields.io/badge/node-%3E=12-green.svg" alt="Node" ></a>
22
21
  </div>
23
22
  <br />
24
23
 
@@ -273,7 +272,7 @@ $ npm run start:vite # 以 vite 模式启动,等价于 npx ssr start --vite
273
272
 
274
273
  <div style="display:flex">
275
274
  <img src="https://res.wx.qq.com/op_res/7F1t4Z8yCHWilehbcFGjAj0yVn0URMiWBGVJa-TVu_eqw5IwUXA2kPYBnfX6YRHy0FVBB-yC6l0IEL02QTJkLg" width="300">
276
- <img src="https://res.wx.qq.com/op_res/7SpflSUP3RJ5InL7FkN0-9JeTj18T_lvqJXXHLNNpY_owTyqtgVH8qMqjk4w7S6YeDWZmUP-N_4vLLAUCdySTA" width="300">
275
+ <img src="https://res.wx.qq.com/op_res/UXZQkqMG9Ej1Ox4pro3iDJPugn8EGQN7xKWXTDh0L0xgK7BOUZvT-MQ_Diks_iTtCL3Kregp-lS52WXsiDctuw" width="300">
277
276
  </div>
278
277
 
279
278
  ## 前端开发手册
@@ -283,3 +282,7 @@ $ npm run start:vite # 以 vite 模式启动,等价于 npx ssr start --vite
283
282
  ## 项目 Star 数增长趋势
284
283
 
285
284
  [![Stargazers over time](https://starchart.cc/zhangyuang/ssr.svg)](https://starchart.cc/zhangyuang/ssr)
285
+
286
+ ## 代码行数
287
+
288
+ ![](https://res.wx.qq.com/op_res/sE2C4qCTn9IN1dyiw4MMTEU9dW40eFXbfWe6-o31-kWEJN0ddQKR41_ZbAwAE01oW5yQj4zV3UJ_rVbX0D99Mw)
@@ -86,10 +86,10 @@ const getBaseConfig = (chain, isServer) => {
86
86
  .add([/ssr-plugin-react/, /ssr-client-utils/, /ssr-hoc-react/]);
87
87
  let babelForExtraModule;
88
88
  if (babelExtraModule) {
89
- babelForExtraModule = module.add(babelExtraModule).end();
89
+ babelForExtraModule = module.add(babelExtraModule).end().exclude.add(/node_modules|core-js/).end();
90
90
  }
91
91
  else {
92
- babelForExtraModule = module.end();
92
+ babelForExtraModule = module.end().exclude.add(/node_modules|core-js/).end();
93
93
  }
94
94
  addBabelLoader(babelModule, envOptions);
95
95
  addBabelLoader(babelForExtraModule, envOptions);
@@ -1,4 +1,4 @@
1
- import type { UserConfig } from 'vite';
1
+ import { UserConfig } from 'vite';
2
2
  declare const serverConfig: UserConfig;
3
3
  declare const clientConfig: UserConfig;
4
4
  declare const viteStart: () => Promise<void>;
package/cjs/tools/vite.js CHANGED
@@ -2,10 +2,10 @@
2
2
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.clientConfig = exports.serverConfig = exports.viteStart = exports.viteBuild = void 0;
5
+ const vite_1 = require("vite");
5
6
  const ssr_server_utils_1 = require("ssr-server-utils");
6
7
  const plugin_react_1 = require("@vitejs/plugin-react");
7
8
  const vite_plugin_style_import_1 = require("vite-plugin-style-import");
8
- const build = require('vite').build;
9
9
  const { getOutput, reactServerEntry, reactClientEntry, viteConfig, supportOptinalChaining, isDev, define, babelOptions } = (0, ssr_server_utils_1.loadConfig)();
10
10
  const { clientOutPut, serverOutPut } = getOutput();
11
11
  const styleImportConfig = {
@@ -94,7 +94,7 @@ const viteStart = async () => {
94
94
  };
95
95
  exports.viteStart = viteStart;
96
96
  const viteBuild = async () => {
97
- await build({ ...clientConfig, mode: 'production' });
98
- await build({ ...serverConfig, mode: 'production' });
97
+ await (0, vite_1.build)({ ...clientConfig, mode: 'production' });
98
+ await (0, vite_1.build)({ ...serverConfig, mode: 'production' });
99
99
  };
100
100
  exports.viteBuild = viteBuild;
@@ -83,10 +83,10 @@ const getBaseConfig = (chain, isServer) => {
83
83
  .add([/ssr-plugin-react/, /ssr-client-utils/, /ssr-hoc-react/]);
84
84
  let babelForExtraModule;
85
85
  if (babelExtraModule) {
86
- babelForExtraModule = module.add(babelExtraModule).end();
86
+ babelForExtraModule = module.add(babelExtraModule).end().exclude.add(/node_modules|core-js/).end();
87
87
  }
88
88
  else {
89
- babelForExtraModule = module.end();
89
+ babelForExtraModule = module.end().exclude.add(/node_modules|core-js/).end();
90
90
  }
91
91
  addBabelLoader(babelModule, envOptions);
92
92
  addBabelLoader(babelForExtraModule, envOptions);
@@ -1,4 +1,4 @@
1
- import type { UserConfig } from 'vite';
1
+ import { UserConfig } from 'vite';
2
2
  declare const serverConfig: UserConfig;
3
3
  declare const clientConfig: UserConfig;
4
4
  declare const viteStart: () => Promise<void>;
package/esm/tools/vite.js CHANGED
@@ -1,8 +1,8 @@
1
1
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
2
+ import { build } from 'vite';
2
3
  import { loadConfig, chunkNamePlugin, rollupOutputOptions, manifestPlugin, commonConfig, asyncOptimizeChunkPlugin } from 'ssr-server-utils';
3
4
  import react from '@vitejs/plugin-react';
4
5
  import styleImport, { AndDesignVueResolve, VantResolve, ElementPlusResolve, NutuiResolve, AntdResolve } from 'vite-plugin-style-import';
5
- const build = require('vite').build;
6
6
  const { getOutput, reactServerEntry, reactClientEntry, viteConfig, supportOptinalChaining, isDev, define, babelOptions } = loadConfig();
7
7
  const { clientOutPut, serverOutPut } = getOutput();
8
8
  const styleImportConfig = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ssr-plugin-react",
3
- "version": "6.1.48",
3
+ "version": "6.1.49",
4
4
  "description": "plugin-react for ssr",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./esm/index.js",
@@ -55,10 +55,10 @@
55
55
  "postcss-safe-parser": "4.0.1",
56
56
  "react-dev-utils": "^11.0.4",
57
57
  "serialize-javascript": "^6.0.0",
58
- "ssr-client-utils": "^6.1.48",
59
- "ssr-hoc-react": "^6.1.48",
60
- "ssr-server-utils": "^6.1.48",
61
- "ssr-webpack": "^6.1.48",
58
+ "ssr-client-utils": "^6.1.49",
59
+ "ssr-hoc-react": "^6.1.49",
60
+ "ssr-server-utils": "^6.1.49",
61
+ "ssr-webpack": "^6.1.49",
62
62
  "terser-webpack-plugin": "^2.3.5",
63
63
  "url-loader": "^4.1.1",
64
64
  "vite": "^2.7.0",
@@ -74,7 +74,7 @@
74
74
  "@types/react-router-dom": "^5.1.3",
75
75
  "@types/webpack": "^4.41.10",
76
76
  "concurrently": "^5.1.0",
77
- "ssr-types-react": "^6.1.48"
77
+ "ssr-types-react": "^6.1.49"
78
78
  },
79
- "gitHead": "104b30653d5e3860cda1a4ed321a432306e5832d"
79
+ "gitHead": "4425a2049f65cd6865f7648611f89854f1982625"
80
80
  }
@@ -93,9 +93,9 @@ const getBaseConfig = (chain: WebpackChain, isServer: boolean) => {
93
93
 
94
94
  let babelForExtraModule
95
95
  if (babelExtraModule) {
96
- babelForExtraModule = module.add(babelExtraModule).end()
96
+ babelForExtraModule = module.add(babelExtraModule).end().exclude.add(/node_modules|core-js/).end()
97
97
  } else {
98
- babelForExtraModule = module.end()
98
+ babelForExtraModule = module.end().exclude.add(/node_modules|core-js/).end()
99
99
  }
100
100
 
101
101
  addBabelLoader(babelModule, envOptions)
@@ -9,7 +9,7 @@ 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
11
  const loadModule = loadModuleFromFramework
12
- let asyncChunkMap: Record<string, string> = {}
12
+ let asyncChunkMap: Record<string, string[]> = {}
13
13
 
14
14
  const getClientWebpack = (chain: WebpackChain) => {
15
15
  const { isDev, chunkName, getOutput, cwd, useHash, chainClientConfig } = loadConfig()
package/src/tools/vite.ts CHANGED
@@ -1,15 +1,8 @@
1
- import type { build as BuildType, UserConfig } from 'vite'
1
+ import { build, UserConfig } from 'vite'
2
2
  import { loadConfig, chunkNamePlugin, rollupOutputOptions, manifestPlugin, commonConfig, asyncOptimizeChunkPlugin } from 'ssr-server-utils'
3
3
  import react from '@vitejs/plugin-react'
4
- import styleImport, {
5
- AndDesignVueResolve,
6
- VantResolve,
7
- ElementPlusResolve,
8
- NutuiResolve,
9
- AntdResolve
10
- } from 'vite-plugin-style-import'
4
+ import styleImport, { AndDesignVueResolve, VantResolve, ElementPlusResolve, NutuiResolve, AntdResolve } from 'vite-plugin-style-import'
11
5
 
12
- const build: typeof BuildType = require('vite').build
13
6
  const { getOutput, reactServerEntry, reactClientEntry, viteConfig, supportOptinalChaining, isDev, define, babelOptions } = loadConfig()
14
7
 
15
8
  const { clientOutPut, serverOutPut } = getOutput()