@ecoding/base.build 0.1.1 → 0.1.4

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.
@@ -1,11 +1,13 @@
1
+ const { customConfig } = require("../z-helpers/config");
1
2
  const nodeExternals = require("webpack-node-externals");
2
3
 
3
4
  const getExternals = () => {
4
- return {
5
- // "@alilc/lowcode-engine": "var window.AliLowCodeEngine",
6
- // "@alilc/lowcode-engine-ext": "var window.AliLowCodeEngineExt",
7
- ...nodeExternals(),
8
- };
5
+ return [
6
+ // { "@alilc/lowcode-engine": "var window.AliLowCodeEngine" },
7
+ // { "@alilc/lowcode-engine-ext": "var window.AliLowCodeEngineExt" },
8
+ nodeExternals(),
9
+ customConfig.ssr.externals
10
+ ]
9
11
  };
10
12
 
11
13
  module.exports = getExternals;
@@ -1,25 +1,23 @@
1
- const { rootPath } = require("./z-helpers/paths");
2
1
  const webpack = require("webpack");
2
+ const { rootPath } = require("./z-helpers/paths");
3
+ const fs = require("fs");
4
+ const isABC = fs.existsSync(rootPath("abc.js"));
3
5
  const { CleanWebpackPlugin } = require("clean-webpack-plugin");
4
-
6
+ if (isABC) {
7
+ customConfig = require(rootPath("abc.js"));
8
+ } else {
9
+ throw new Error("not found abc.js");
10
+ }
11
+ if (!customConfig.dll) {
12
+ throw new Error("has no dll config");
13
+ }
5
14
  module.exports = {
6
15
  entry: {
7
- dll: [
8
- "react",
9
- "react-dom",
10
- "react-helmet",
11
- "react-router-dom",
12
- "react-redux",
13
- "redux",
14
- "redux-thunk",
15
- "hoist-non-react-statics",
16
- "axios",
17
- "classnames",
18
- "@ecoding/helper.request"
19
- ]
16
+ dll: customConfig.dll
20
17
  //other:['a','b','c']
21
18
  },
22
19
  mode: "production",
20
+ devtool: false,
23
21
  output: {
24
22
  // 输出出口指定
25
23
  filename: "[name]_[fullhash].js", // name就是jquery
@@ -52,6 +52,10 @@ const getWebpackConfig = (env) => {
52
52
  const externals = getExternals();
53
53
  const config = {
54
54
  target: "node",
55
+ node: {
56
+ global: false,
57
+ Buffer: false,
58
+ },
55
59
  mode,
56
60
  cache,
57
61
  entry,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecoding/base.build",
3
- "version": "0.1.1",
3
+ "version": "0.1.4",
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": "3019d264eb9d66b07adc2deeec0eff34a2eeed67"
56
+ "gitHead": "c7bd3e2ec6200fc4c536a6c0dabbb0914d48445c"
57
57
  }
@@ -1,38 +0,0 @@
1
- const { rootPath } = require("./z-helpers/paths");
2
- const webpack = require("webpack");
3
- const { CleanWebpackPlugin } = require("clean-webpack-plugin");
4
-
5
- module.exports = {
6
- entry: {
7
- dll: [
8
- "react",
9
- "react-dom",
10
- "react-helmet",
11
- "react-router-dom",
12
- "hoist-non-react-statics",
13
- "axios",
14
- "classnames",
15
- "@ecoding/components.dom",
16
- "@ecoding/helper.env",
17
- "@ecoding/helper.url",
18
- "@ecoding/helper.storage.local",
19
- "@ecoding/helper.request"
20
- ]
21
- //other:['a','b','c']
22
- },
23
- mode: "production",
24
- output: {
25
- // 输出出口指定
26
- filename: "[name]_[fullhash].js", // name就是jquery
27
- path: rootPath("dll"), // 打包到dll目录下
28
- library: "[name]_[fullhash]" // 打包的库里面向外暴露出去的内容叫什么名字
29
- },
30
- plugins: [
31
- new CleanWebpackPlugin(),
32
- // 打包生成一个manifest.json --> 提供jquery的映射关系(告诉webpack:jquery之后不需要再打包和暴露内容的名称)
33
- new webpack.DllPlugin({
34
- name: "[name]_[fullhash]", // 映射库的暴露的内容名称
35
- path: rootPath("dll/manifest_[name]_[fullhash].json") // 输出文件路径
36
- })
37
- ]
38
- };