-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathwebpack.sample.config.babel.js
58 lines (53 loc) · 1.35 KB
/
webpack.sample.config.babel.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
import path from 'path'
import webpack, { DefinePlugin } from 'webpack'
import WebpackMerger from 'webpack-merge'
import HtmlWebpackPlugin from 'html-webpack-plugin'
import WebpackConf from './webpack.common.config.babel'
import { srcDir, demoDir } from './variables'
import { name as Name } from './package.json'
const { UglifyJsPlugin } = webpack.optimize
export default WebpackMerger(WebpackConf, {
devtool: 'source-map',
entry: {
index: path.join(srcDir, './index.js'),
frame: path.join(srcDir, './frame.js')
},
output: {
path: demoDir,
publicPath: `/${Name}/${path.basename(demoDir)}/`,
umdNamedDefine: false
},
plugins: [
/**
* Define some global variables
*/
new DefinePlugin({
'process.env': {
development: JSON.stringify(true)
}
}),
new HtmlWebpackPlugin({
filename: path.join(demoDir, './index.html'),
template: path.join(srcDir, './index.pug'),
excludeChunks: ['frame']
}),
new HtmlWebpackPlugin({
filename: path.join(demoDir, './frame.html'),
template: path.join(srcDir, './frame.pug'),
excludeChunks: ['index']
}),
/**
* Compress js files
*/
new UglifyJsPlugin({
sourceMap: false,
mangle: false,
compress: {
warnings: false
},
output: {
comments: false
}
})
]
})