-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
58 lines (48 loc) · 1.18 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
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const merge = require('webpack-merge');
const devserver = require('./webpack/devserver');
const uglifyJS = require('./webpack/js.uglify');
const babel = require('./webpack/babel');
const PATHS = {
source: path.join(__dirname, 'source'),
build: path.join(__dirname, 'build')
};
process.traceDeprecation = true;
const common = merge([
{
entry: {
'index': PATHS.source + '/main.js',
},
output: {
library: "snake",
path: PATHS.build,
filename: 'js/[name].js'
},
plugins: [
new HtmlWebpackPlugin({
filename: 'index.html',
chunks: ['index', 'common'],
}),
],
},
babel(),
]);
module.exports = (env) => {
if (env === 'production') {
return merge([
common,
uglifyJS(),
]);
}
if (env === 'development') {
return merge([
common,
{
devtool: 'source-map'
},
devserver(),
])
}
};