forked from krakenjs/zoid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
188 lines (159 loc) · 4.05 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
/* @flow */
/* eslint import/no-nodejs-modules: off, import/no-default-export: off */
import type { WebpackConfig } from "@krakenjs/webpack-config-grumbler/index.flow";
import {
getWebpackConfig,
getNextVersion,
} from "@krakenjs/webpack-config-grumbler";
import { argv } from "yargs";
import pkg from "./package.json";
import globals from "./globals";
const __NEXT_VERSION__ = getNextVersion(pkg, argv.level);
const zoidGlobals = {
...globals,
__ZOID__: {
...globals.__ZOID__,
__VERSION__: __NEXT_VERSION__,
__GLOBAL_KEY__: `__zoid_${__NEXT_VERSION__}__`,
},
};
export const FILE_NAME = "zoid";
export const MODULE_NAME = "zoid";
export const WEBPACK_CONFIG: WebpackConfig = getWebpackConfig({
filename: `${FILE_NAME}.js`,
modulename: MODULE_NAME,
vars: zoidGlobals,
minify: false,
});
export const WEBPACK_CONFIG_MIN: WebpackConfig = getWebpackConfig({
filename: `${FILE_NAME}.min.js`,
modulename: MODULE_NAME,
minify: true,
vars: zoidGlobals,
});
export const WEBPACK_CONFIG_FRAME: WebpackConfig = getWebpackConfig({
filename: `${FILE_NAME}.frame.js`,
modulename: MODULE_NAME,
minify: false,
vars: {
...zoidGlobals,
__POST_ROBOT__: {
...zoidGlobals.__POST_ROBOT__,
__IE_POPUP_SUPPORT__: false,
},
__ZOID__: {
...zoidGlobals.__ZOID__,
__DEFAULT_PRERENDER__: false,
__POPUP_SUPPORT__: false,
},
},
});
export const WEBPACK_CONFIG_FRAME_MIN: WebpackConfig = getWebpackConfig({
filename: `${FILE_NAME}.frame.min.js`,
modulename: MODULE_NAME,
minify: true,
vars: {
...zoidGlobals,
__POST_ROBOT__: {
...zoidGlobals.__POST_ROBOT__,
__IE_POPUP_SUPPORT__: false,
},
__ZOID__: {
...zoidGlobals.__ZOID__,
__DEFAULT_PRERENDER__: false,
__POPUP_SUPPORT__: false,
},
},
});
export const WEBPACK_CONFIG_FRAMEWORK: WebpackConfig = getWebpackConfig({
filename: `${FILE_NAME}.frameworks.js`,
modulename: MODULE_NAME,
minify: false,
vars: {
...zoidGlobals,
__POST_ROBOT__: {
...zoidGlobals.__POST_ROBOT__,
__IE_POPUP_SUPPORT__: true,
},
__ZOID__: {
...zoidGlobals.__ZOID__,
__POPUP_SUPPORT__: true,
__FRAMEWORK_SUPPORT__: true,
},
},
});
export const WEBPACK_CONFIG_FRAMEWORK_MIN: WebpackConfig = getWebpackConfig({
filename: `${FILE_NAME}.frameworks.min.js`,
modulename: MODULE_NAME,
minify: true,
vars: {
...zoidGlobals,
__POST_ROBOT__: {
...zoidGlobals.__POST_ROBOT__,
__IE_POPUP_SUPPORT__: true,
},
__ZOID__: {
...zoidGlobals.__ZOID__,
__POPUP_SUPPORT__: true,
__FRAMEWORK_SUPPORT__: true,
},
},
});
export const WEBPACK_CONFIG_FRAMEWORK_FRAME: WebpackConfig = getWebpackConfig({
filename: `${FILE_NAME}.frameworks.frame.js`,
modulename: MODULE_NAME,
minify: false,
vars: {
...zoidGlobals,
__POST_ROBOT__: {
...zoidGlobals.__POST_ROBOT__,
__IE_POPUP_SUPPORT__: false,
},
__ZOID__: {
...zoidGlobals.__ZOID__,
__POPUP_SUPPORT__: false,
__FRAMEWORK_SUPPORT__: true,
},
},
});
export const WEBPACK_CONFIG_FRAMEWORK_FRAME_MIN: WebpackConfig =
getWebpackConfig({
filename: `${FILE_NAME}.frameworks.frame.min.js`,
modulename: MODULE_NAME,
minify: true,
vars: {
...zoidGlobals,
__POST_ROBOT__: {
...zoidGlobals.__POST_ROBOT__,
__IE_POPUP_SUPPORT__: false,
},
__ZOID__: {
...zoidGlobals.__ZOID__,
__POPUP_SUPPORT__: false,
__FRAMEWORK_SUPPORT__: true,
},
},
});
export const WEBPACK_CONFIG_TEST: WebpackConfig = getWebpackConfig({
test: true,
entry: "./test/zoid.js",
libraryTarget: undefined,
vars: {
...zoidGlobals,
__ZOID__: {
...zoidGlobals.__ZOID__,
__POPUP_SUPPORT__: true,
__FRAMEWORK_SUPPORT__: true,
},
},
});
export default [
WEBPACK_CONFIG,
WEBPACK_CONFIG_MIN,
WEBPACK_CONFIG_FRAME,
WEBPACK_CONFIG_FRAME_MIN,
WEBPACK_CONFIG_FRAMEWORK,
WEBPACK_CONFIG_FRAMEWORK_MIN,
WEBPACK_CONFIG_FRAMEWORK_FRAME,
WEBPACK_CONFIG_FRAMEWORK_FRAME_MIN,
];