webpack.config.js
1.23 KB
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
/**
* Configs file for bundling
* @author NHN.
* FE Development Lab <dl_javascript@nhn.com>
*/
'use strict';
var pkg = require('./package.json');
var webpack = require('webpack');
var SafeUmdPlugin = require('safe-umd-webpack-plugin');
var isProduction = process.argv.indexOf('--production') >= 0;
var FILENAME = pkg.name + (isProduction ? '.min.js' : '.js');
var BANNER = [
FILENAME,
'@version ' + pkg.version,
'@author ' + pkg.author,
'@license ' + pkg.license
].join('\n');
var config = {
eslint: {
failOnError: isProduction
},
entry: './src/js/index.js',
output: {
library: ['tui', 'util'],
libraryTarget: 'umd',
path: 'dist',
publicPath: 'dist',
filename: FILENAME
},
module: {
preLoaders: [
{
test: /\.js$/,
exclude: /(bower_components|node_modules)/,
loader: 'eslint-loader'
}
]
},
plugins: [
new SafeUmdPlugin(),
new webpack.BannerPlugin(BANNER)
]
};
if (isProduction) {
config.plugins.push(new webpack.optimize.UglifyJsPlugin({
compress: {
'screw_ie8': false
}
}));
}
module.exports = config;