@ecoding/base.build 0.0.13 → 0.0.15

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/README.md CHANGED
@@ -9,8 +9,8 @@
9
9
  mpa: boolean, // 是否是多页
10
10
  dll:boolean, // 是否打dll
11
11
  micro:"main" | "child", // 微前端主应用或子应用 默认null
12
- outputLibrary: string, // micro == child时生效
13
- publicPath: string,
12
+ outputLibrary: string, // micro == child时生效,整个库向外暴露的变量名
13
+ publicPath: string, // cdn 资源前缀
14
14
  outputPath: string, // build bundle 目录,相对命令执行目录
15
15
  externals: object;
16
16
  /* externals
@@ -22,6 +22,11 @@
22
22
  dev:{
23
23
  publicPath: string; // devserver 读这个
24
24
  port: number, // devserver 端口 默认 8080
25
+ // https 支持
26
+ https: {
27
+ key: fs.readFileSync(path.join(__dirname, "./local.cxc.tech-key.pem")),
28
+ cert: fs.readFileSync(path.join(__dirname, "./local.cxc.tech.pem"))
29
+ }
25
30
  }
26
31
  }
27
32
  ```
@@ -55,7 +60,8 @@ module.exports = {
55
60
  "@babel/preset-env": "7.18.2", // babel插件集合
56
61
  "@babel/preset-react": "7.17.12", // babel 支持 react 插件
57
62
  "@babel/preset-typescript": "7.17.12", // babel 支持 typescript 插件
58
- "@ecoding/base.mock": "^0.0.2", // 自己写的mock插件
63
+ "@ecoding/base.mock": "0.*", // 自己写的mock插件
64
+ "@ecoding/base.spec": "*",
59
65
  "@svgr/webpack": "6.2.1", // webpack svg 插件
60
66
  "@typescript-eslint/eslint-plugin": "5.28.0", // eslint ts 插件
61
67
  "@typescript-eslint/parser": "5.28.0", // eslint ts 编译器
@@ -64,6 +70,7 @@ module.exports = {
64
70
  "babel-eslint": "10.1.0",
65
71
  "babel-loader": "8.2.5",
66
72
  "clean-webpack-plugin": "^4.0.0",
73
+ "concurrently": "^7.3.0", // 并行执行node 命令
67
74
  "core-js": "3.23.1",
68
75
  "cross-env": "7.0.3",
69
76
  "css-loader": "6.7.1",
@@ -78,10 +85,12 @@ module.exports = {
78
85
  "postcss-loader": "7.0.0", // css向下兼容
79
86
  "style-loader": "3.3.1", // 编译 style 内联css
80
87
  "terser-webpack-plugin": "5.3.3", // js压缩
88
+ "typescript": "4.8.3",
81
89
  "webpack": "5.73.0",
82
90
  "webpack-cli": "4.10.0",
83
91
  "webpack-dev-server": "4.9.2",
84
92
  "webpack-merge": "5.8.0",
93
+ "webpack-node-externals": "^3.0.0", // 打包ssr时用
85
94
  "webpackbar": "5.0.2"
86
95
  }
87
96
  ```
@@ -1,9 +1,11 @@
1
- const { rootPath, ssrEntry } = require("../z-helpers/paths");
1
+ const { rootPath } = require("../z-helpers/paths");
2
+ const { getSSRMPAEntries } = require("../z-helpers/mpa.entries");
2
3
  const { customConfig } = require("../z-helpers/config");
3
4
 
4
5
  const getEntries = () => {
5
6
  if (customConfig.mpa) {
6
- return ssrEntry.pagesObj;
7
+ const entry = getSSRMPAEntries();
8
+ return entry.pagesObj;
7
9
  }
8
10
  return {
9
11
  app: rootPath("./src/server-render.tsx")
@@ -14,7 +14,7 @@ const pubPath = () => {
14
14
  const getOutput = () => {
15
15
  return Object.assign({
16
16
  // 输出文件目录(将来所有资源输出的公共目录)
17
- path: rootPath(customConfig.outputPath || "../../src/ssr"),
17
+ path: rootPath(customConfig.outputPath || "../src/ssr"),
18
18
 
19
19
  /**
20
20
  * 所有资源引入公共路径前缀 --> 'imgs/a.jpg' --> '/imgs/a.jpg'
@@ -1,15 +1,12 @@
1
1
  const { Production, Development } = require("./z-helpers/const");
2
2
  const { isEnvDevelopment } = require("./z-helpers/util");
3
- const { customConfig } = require("./z-helpers/config");
4
3
  const getEntries = require("./entries/ssr");
5
4
  const getOutput = require("./output/ssr");
6
5
  const { getSSROptimization } = require("./optimization");
7
6
  const getModule = require("./module/ssr");
8
7
  const { getResolve, getResolveLoader } = require("./resolve");
9
- const getPlugins = require("./plugins/ssr");
10
8
  const getExternals = require("./externals/ssr");
11
9
 
12
-
13
10
  /**
14
11
  *
15
12
  * @param {*} cmdOpts : build时 { WEBPACK_BUNDLE: true, WEBPACK_BUILD: true } | 本地开发dev时 { WEBPACK_SERVE: true }
@@ -51,9 +48,6 @@ const getWebpackConfig = (env) => {
51
48
  // 配置resolve
52
49
  const resolve = getResolve();
53
50
 
54
- // 配置plugins
55
- const plugins = getPlugins();
56
-
57
51
  // 配置externals
58
52
  const externals = getExternals();
59
53
  const config = {
@@ -66,7 +60,6 @@ const getWebpackConfig = (env) => {
66
60
  optimization,
67
61
  module,
68
62
  resolve,
69
- plugins,
70
63
  externalsPresets: { node: true }, // 不打包 node 模块,什么 fs path 那些
71
64
  externals, // 不打包 node_modules 内的模块,什么 express react react-dom 那些
72
65
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecoding/base.build",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "description": "tpl building",
5
5
  "author": "cxc",
6
6
  "license": "MIT",
@@ -53,5 +53,5 @@
53
53
  "publishConfig": {
54
54
  "access": "public"
55
55
  },
56
- "gitHead": "e95d9c3fa16848e2190709e30917b918935a366b"
56
+ "gitHead": "2106c9b443c0f004ba9c17ac744cc19be15998e5"
57
57
  }
@@ -1,18 +0,0 @@
1
- const WebpackBar = require("webpackbar");
2
- const MiniCssExtractPlugin = require("mini-css-extract-plugin"); // 提取分离css
3
- const { isEnvProduction } = require("../z-helpers/util");
4
-
5
- module.exports = () => {
6
- const plugins = [
7
- new WebpackBar({
8
- profile: true
9
- }),
10
-
11
- isEnvProduction &&
12
- new MiniCssExtractPlugin({
13
- // filename: 'css/[name].css',
14
- filename: "[id].[chunkhash:5].css"
15
- })
16
- ].filter(Boolean);
17
- return plugins;
18
- };