-
Notifications
You must be signed in to change notification settings - Fork 7
/
webpack.config.js
118 lines (109 loc) · 1.95 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
const DeepScope = require('webpack-deep-scope-plugin').default
const core = {
mode: 'none',
entry: __dirname + '/src/index.js',
output: {
path: __dirname + '/dist',
filename: 'index.js',
library: 'tyshemo',
libraryTarget: 'umd',
globalObject: `typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : this`,
},
resolve: {
alias: {
'ts-fns': 'ts-fns/es',
},
},
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
},
],
},
plugins: [
new DeepScope(),
],
optimization: {
usedExports: true,
sideEffects: true,
},
devtool: 'source-map',
}
const coreMini = {
...core,
mode: 'production',
output: {
...core.output,
filename: 'index.min.js',
},
optimization: {
...core.optimization,
minimize: true,
},
}
const ty = {
...core,
entry: __dirname + '/src/ty/index.js',
output: {
...core.output,
library: 'ty',
filename: 'ty.js',
},
}
const tyMini = {
...coreMini,
entry: __dirname + '/src/ty/index.js',
output: {
...coreMini.output,
library: 'ty',
filename: 'ty.min.js',
},
}
const store = {
...core,
entry: __dirname + '/src/store.js',
output: {
...core.output,
library: 'store',
filename: 'store.js',
},
}
const storeMini = {
...coreMini,
entry: __dirname + '/src/store.js',
output: {
...coreMini.output,
library: 'store',
filename: 'store.min.js',
},
}
const complete = {
...core,
entry: __dirname + '/src/complete/index.js',
output: {
...core.output,
library: 'tyshemo',
filename: 'tyshemo.js',
},
}
const completeMini = {
...coreMini,
entry: __dirname + '/src/complete/index.js',
output: {
...core.output,
library: 'tyshemo',
filename: 'tyshemo.min.js',
},
}
module.exports = [
core,
coreMini,
ty,
tyMini,
store,
storeMini,
complete,
completeMini,
]