emacroh5lib 1.0.1 → 1.0.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.
@@ -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
@@ -10,7 +10,7 @@
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,6 +3,8 @@
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
+
6
8
  const webpack = require('webpack');
7
9
 
8
10
  const isProduction = process.env.NODE_ENV == "production";
@@ -22,6 +24,7 @@ const config = {
22
24
  },
23
25
  output: {
24
26
  filename: 'emacroh5lib.min.js',
27
+ // publicPath: process.env.NODE_ENV === "development" ? "/" : "/emacroh5lib/",
25
28
  path: path.resolve(__dirname, "dist"),
26
29
  library: {
27
30
  // do not specify a `name` here
@@ -32,6 +35,9 @@ const config = {
32
35
  open: true,
33
36
  host: "localhost",
34
37
  },
38
+ externals: {
39
+ './cptable': 'var cptable'
40
+ },
35
41
  plugins: [
36
42
  // new HtmlWebpackPlugin({
37
43
  // template: "index.html",
@@ -48,9 +54,24 @@ const config = {
48
54
  ],
49
55
  module: {
50
56
  rules: [
57
+ {
58
+ test: /\.(vue)$/,
59
+ use: [
60
+ {
61
+ loader: 'vue-loader',
62
+ options: {
63
+ esModule: false
64
+ }
65
+ }
66
+ ]
67
+ },
51
68
  {
52
69
  test: /\.(ts|tsx)$/i,
53
70
  loader: "ts-loader",
71
+ options: {
72
+ appendTsSuffixTo: [/\.(vue)$/],
73
+ transpileOnly: true //只进行语法转换, 不进行类型校验, 提高构建速度
74
+ },
54
75
  exclude: ["/node_modules/"],
55
76
  },
56
77
  {
@@ -62,7 +83,7 @@ const config = {
62
83
  use: [stylesHandler, "css-loader", "postcss-loader"],
63
84
  },
64
85
  {
65
- test: /\.(eot|svg|ttf|woff|woff2|png|jpg|gif)$/i,
86
+ test: /\.(eot|svg|ttf|woff|woff2|png|jpg|gif|ico)$/i,
66
87
  type: "asset/inline"
67
88
  },
68
89
 
@@ -75,7 +96,11 @@ const config = {
75
96
  alias: {
76
97
  '@': resolve('src')
77
98
  },
78
- extensions: [".tsx", ".ts", ".js"],
99
+ fallback: {
100
+ crypto: false,
101
+ fs: false
102
+ },
103
+ extensions: ['.js', '.jsx', '.ts', '.tsx', '.vue', '.json'],
79
104
  }
80
105
  };
81
106
 
@@ -84,6 +109,7 @@ module.exports = () => {
84
109
  config.mode = "production";
85
110
 
86
111
  config.plugins.push(new MiniCssExtractPlugin());
112
+ config.plugins.push(new VueLoaderPlugin());
87
113
  } else {
88
114
  config.mode = "development";
89
115
  }