@ecoding/base.build 0.0.13 → 0.0.14
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/libs/entries/ssr.js +4 -2
- package/libs/output/ssr.js +1 -1
- package/libs/webpack.ssr.js +0 -6
- package/package.json +2 -2
- package/libs/plugins/ssr.js +0 -18
package/libs/entries/ssr.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
const { rootPath
|
|
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
|
-
|
|
7
|
+
const entry = getSSRMPAEntries();
|
|
8
|
+
return entry.pagesObj;
|
|
7
9
|
}
|
|
8
10
|
return {
|
|
9
11
|
app: rootPath("./src/server-render.tsx")
|
package/libs/output/ssr.js
CHANGED
|
@@ -14,7 +14,7 @@ const pubPath = () => {
|
|
|
14
14
|
const getOutput = () => {
|
|
15
15
|
return Object.assign({
|
|
16
16
|
// 输出文件目录(将来所有资源输出的公共目录)
|
|
17
|
-
path: rootPath(customConfig.outputPath || "
|
|
17
|
+
path: rootPath(customConfig.outputPath || "../src/ssr"),
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* 所有资源引入公共路径前缀 --> 'imgs/a.jpg' --> '/imgs/a.jpg'
|
package/libs/webpack.ssr.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
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
10
|
|
|
@@ -51,9 +49,6 @@ const getWebpackConfig = (env) => {
|
|
|
51
49
|
// 配置resolve
|
|
52
50
|
const resolve = getResolve();
|
|
53
51
|
|
|
54
|
-
// 配置plugins
|
|
55
|
-
const plugins = getPlugins();
|
|
56
|
-
|
|
57
52
|
// 配置externals
|
|
58
53
|
const externals = getExternals();
|
|
59
54
|
const config = {
|
|
@@ -66,7 +61,6 @@ const getWebpackConfig = (env) => {
|
|
|
66
61
|
optimization,
|
|
67
62
|
module,
|
|
68
63
|
resolve,
|
|
69
|
-
plugins,
|
|
70
64
|
externalsPresets: { node: true }, // 不打包 node 模块,什么 fs path 那些
|
|
71
65
|
externals, // 不打包 node_modules 内的模块,什么 express react react-dom 那些
|
|
72
66
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecoding/base.build",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
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": "
|
|
56
|
+
"gitHead": "b18b6f1081b99dc2fd768f37c250a245558dbf18"
|
|
57
57
|
}
|
package/libs/plugins/ssr.js
DELETED
|
@@ -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
|
-
};
|