emacroh5lib 1.0.0 → 1.0.3

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.
@@ -0,0 +1,7 @@
1
+ import { VueConstructor } from 'vue';
2
+
3
+ declare module 'vue/types/vue' {
4
+ interface VueConstructor {
5
+ entryName: string;
6
+ }
7
+ }
package/tsconfig.json CHANGED
@@ -4,13 +4,13 @@
4
4
  "outDir": "./dist/", // 打包到的目录
5
5
  "sourceMap": true, // 是否生成sourceMap(用于浏览器调试)
6
6
  "noImplicitAny": false,
7
- "noUnusedLocals": true,
7
+ "noUnusedLocals": false,
8
8
  "noUnusedParameters": true,
9
9
  "declaration": true, // 是否生成声明文件
10
10
  "declarationDir": "./dist/types/", // 声明文件打包的位置
11
11
  "declarationMap": false, // 是否生成声明文件map文件(便于调试)
12
12
  "moduleResolution": "node",
13
- "module": "esnext",
13
+ "module": "commonjs",
14
14
  "target": "es5", // 转化成的目标语言
15
15
  "baseUrl": "./",
16
16
  "strict": true,
@@ -33,6 +33,7 @@
33
33
  ]
34
34
  },
35
35
  "typeRoots": [
36
+ "/@types",
36
37
  "./node_modules/@types"
37
38
  ],
38
39
  "lib": [
@@ -51,7 +52,7 @@
51
52
  "src/**/*.vue",
52
53
  "tests/**/*.ts",
53
54
  "tests/**/*.tsx"
54
- ], // 要打包的文件
55
+ , "src/components/MessageBox.tsx" ], // 要打包的文件
55
56
  "exclude": [
56
57
  "node_modules",
57
58
  "*.test.ts"
package/typings.d.ts CHANGED
@@ -8,5 +8,5 @@
8
8
  */
9
9
  declare module "*.png";
10
10
  declare module "*.less";
11
- declare module "*.svg";
11
+ declare module "*.svg";
12
12
  declare module "*.json";
package/webpack.config.js CHANGED
@@ -3,9 +3,16 @@
3
3
  const path = require("path");
4
4
  // const HtmlWebpackPlugin = require("html-webpack-plugin");
5
5
  const MiniCssExtractPlugin = require("mini-css-extract-plugin");
6
+ const VueLoaderPlugin = require('vue-loader/lib/plugin')
7
+
8
+ const webpack = require('webpack');
6
9
 
7
10
  const isProduction = process.env.NODE_ENV == "production";
8
11
 
12
+ function resolve(dir) {
13
+ return path.join(__dirname, dir)
14
+ }
15
+
9
16
  const stylesHandler = isProduction
10
17
  ? MiniCssExtractPlugin.loader
11
18
  : "style-loader";
@@ -16,7 +23,8 @@ const config = {
16
23
  outputModule: true,
17
24
  },
18
25
  output: {
19
- filename:'emacroh5lib.min.js',
26
+ filename: 'emacroh5lib.min.js',
27
+ // publicPath: process.env.NODE_ENV === "development" ? "/" : "/emacroh5lib/",
20
28
  path: path.resolve(__dirname, "dist"),
21
29
  library: {
22
30
  // do not specify a `name` here
@@ -27,19 +35,43 @@ const config = {
27
35
  open: true,
28
36
  host: "localhost",
29
37
  },
38
+ externals: {
39
+ './cptable': 'var cptable'
40
+ },
30
41
  plugins: [
31
42
  // new HtmlWebpackPlugin({
32
43
  // template: "index.html",
33
44
  // }),
45
+ new webpack.ProvidePlugin({
46
+ echarts: 'echarts',
47
+ THREE: 'three',
48
+ jQuery: "jquery",
49
+ $: "jquery"
50
+ })
34
51
 
35
52
  // Add your plugins here
36
53
  // Learn more about plugins from https://webpack.js.org/configuration/plugins/
37
54
  ],
38
55
  module: {
39
56
  rules: [
57
+ {
58
+ test: /\.(vue)$/,
59
+ use: [
60
+ {
61
+ loader: 'vue-loader',
62
+ options: {
63
+ esModule: false
64
+ }
65
+ }
66
+ ]
67
+ },
40
68
  {
41
69
  test: /\.(ts|tsx)$/i,
42
70
  loader: "ts-loader",
71
+ options: {
72
+ appendTsSuffixTo: [/\.(vue)$/],
73
+ transpileOnly: true //只进行语法转换, 不进行类型校验, 提高构建速度
74
+ },
43
75
  exclude: ["/node_modules/"],
44
76
  },
45
77
  {
@@ -51,17 +83,25 @@ const config = {
51
83
  use: [stylesHandler, "css-loader", "postcss-loader"],
52
84
  },
53
85
  {
54
- test: /\.(eot|svg|ttf|woff|woff2|png|jpg|gif)$/i,
86
+ test: /\.(eot|svg|ttf|woff|woff2|png|jpg|gif|ico)$/i,
55
87
  type: "asset/inline"
56
88
  },
57
89
 
90
+
58
91
  // Add your rules for custom modules here
59
92
  // Learn more about loaders from https://webpack.js.org/loaders/
60
93
  ],
61
94
  },
62
95
  resolve: {
63
- extensions: [".tsx", ".ts", ".js"],
64
- },
96
+ alias: {
97
+ '@': resolve('src')
98
+ },
99
+ fallback: {
100
+ crypto: false,
101
+ fs: false
102
+ },
103
+ extensions: ['.js', '.jsx', '.ts', '.tsx', '.vue', '.json'],
104
+ }
65
105
  };
66
106
 
67
107
  module.exports = () => {
@@ -69,8 +109,16 @@ module.exports = () => {
69
109
  config.mode = "production";
70
110
 
71
111
  config.plugins.push(new MiniCssExtractPlugin());
112
+ config.plugins.push(new VueLoaderPlugin());
72
113
  } else {
73
114
  config.mode = "development";
74
115
  }
116
+
117
+ // 打包文件大小配置
118
+ config.performance = {
119
+ maxEntrypointSize: 10 * 1024 * 1024,
120
+ maxAssetSize: 10 * 1024 * 1024
121
+ }
122
+
75
123
  return config;
76
124
  };