arisu.js 1.0.0

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,100 @@
1
+ const path = require( 'path' );
2
+ const base = 'dist';
3
+ /**
4
+ // demo 1
5
+ // 打包方式一
6
+ // const name = 'libraryD1ScriptTag';
7
+ // 打包方式二
8
+ // const name = 'libraryD1Commonjs';
9
+ // 打包方式三
10
+ // const name = 'libraryD1Module';
11
+ // 打包方式四,兼容方式一和二,调用方法有变动
12
+ const name = 'libraryD1UMD';
13
+ module.exports = {
14
+ entry: './src/lib-demo-1.js',
15
+ mode: 'production',
16
+ // 打包方式三
17
+ // experiments: {
18
+ // outputModule: true
19
+ // },
20
+ output: {
21
+ path: path.resolve( __dirname, base ),
22
+ filename: name + '.js',
23
+ // clean: true,
24
+ // 打包方式一
25
+ // library: {
26
+ // name: name,
27
+ // type: 'window'
28
+ // }
29
+ // 打包方式二
30
+ // library: {
31
+ // name: name,
32
+ // type: 'commonjs'
33
+ // }
34
+ // 打包方式三
35
+ // library: {
36
+ // type: 'module'
37
+ // }
38
+ // 打包方式四,兼容方式一和二,调用方法有变动
39
+ library: {
40
+ name: name,
41
+ type: 'umd'
42
+ },
43
+ globalObject: 'globalThis'
44
+ }
45
+ }
46
+ **/
47
+ /**
48
+ //demo 2, 引入第三方库及使用JSON数据
49
+ module.exports = {
50
+ entry: './src/index.js',
51
+ mode: 'production',
52
+ output: {
53
+ path: path.resolve( __dirname, base ),
54
+ filename: 'webpack-numbers.js',
55
+ library: {
56
+ name: "webpackNumbers",
57
+ type: "umd"
58
+ },
59
+ globalObject: 'globalThis'
60
+ },
61
+ externals: {
62
+ lodash: {
63
+ commonjs: 'lodash',
64
+ commonjs2: 'lodash',
65
+ amd: 'lodash',
66
+ root: '_',
67
+ },
68
+ },
69
+ };
70
+ **/
71
+
72
+
73
+ module.exports = {
74
+ entry: './src/js/main.js',
75
+ mode: 'production',
76
+ output: {
77
+ path: path.resolve( __dirname, base ),//dist目录,供上线发布
78
+ // path: path.resolve( __dirname, "../p2test/src/assets/js" ),//生成在本地测试目录
79
+ // filename: 'arisu.min.js',
80
+ filename: 'arisu.js',
81
+ library: {
82
+ name: "a",
83
+ type: "umd"
84
+ },
85
+ globalObject: 'globalThis',
86
+ },
87
+ // 取消压缩
88
+ optimization: {
89
+ minimize: false
90
+ },
91
+ // externals: {
92
+ // handlebars: {
93
+ // commonjs: 'handlebars',
94
+ // commonjs2: 'handlebars',
95
+ // amd: 'handlebars',
96
+ // root: 'handlebars'
97
+ // }
98
+ // }
99
+ };
100
+