-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
webpack.config.js
41 lines (39 loc) · 1.13 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
const path = require('path');
/**
* Creates WebPack config.
*
* @param {string} target
* @param {boolean} [minimize]
* @return {{output: {path: string, filename: string, library: {umdNamedDefine: boolean, type}}, entry: {'zuix-bundler': string, zuix: string}, optimization: {minimize: (boolean)}, experiments: {outputModule: (boolean)}}}
*/
function createConfig(target, minimize) {
return {
entry: {
'zuix': './src/js/main.js',
'zuix-bundler': './src/js/bundler.js'
},
output: {
filename: '[name]'+(target !== 'var' ?'.'+target:'')+(minimize?'.min':'')+'.js',
path: path.resolve(__dirname, 'dist/js'),
library: {
name: target === 'var' ? 'zuix' : undefined,
type: target
//auxiliaryComment: 'zUIx.js - brought to you, with love, by G-Labs =)',
//umdNamedDefine: true
}
},
experiments: {
outputModule: target === 'module'
},
optimization: {
minimize: minimize === true
},
target: ['web', 'es5']
};
}
module.exports = [
createConfig('var'),
createConfig('var', true),
createConfig('module'),
createConfig('module', true)
];