/
webpack.config.js
60 lines (53 loc) · 1.25 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
const webpack = require('webpack');
const Dashboard = require('webpack-dashboard');
const DashboardPlugin = require('webpack-dashboard/plugin');
const minimize = process.argv.indexOf('--minimize') !== -1;
const dashboard = process.argv.indexOf('--dashboard') !== -1;
const plugins = [];
const filename = 'zingtouch.js';
const config = {
entry: './src/core/main.js',
output: {
filename: filename,
},
devtool: 'source-map',
module: {
loaders: [
{
// test: path.join(__dirname, 'src'),
test: /\.js$/,
loader: 'babel-loader',
query: {
presets: ['es2015'],
},
},
],
},
plugins: plugins,
};
if (minimize) {
plugins.push(new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
mangle: true,
outputs: {
comments: false,
},
}));
filename = `${filename}.min.js`;
}
if (dashboard) {
plugins.push(new DashboardPlugin(new Dashboard().setData));
config.devServer = {
port: 3000,
contentBase: './examples',
};
config.output.publicPath = '/assets/';
} else {
config.output.filename = __dirname + '/dist/' + filename;
}
plugins.push(new webpack.BannerPlugin(`
ZingTouch v1.0.3
Author: ZingChart http://zingchart.com
License: MIT`
));
module.exports = config;