-
Notifications
You must be signed in to change notification settings - Fork 102
/
Copy pathwebpack.config.js
55 lines (52 loc) · 1.24 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
var webpack = require('webpack');
var path = require('path');
var libraryName = 'skPlayer';
var env = process.env.WEBPACK_ENV;
var DEV_PATH = path.resolve(__dirname,'src');
var BUILD_PATH = path.resolve(__dirname,'dist');
var plugins = [
new webpack.BannerPlugin('SKPlayer')
];
if(env === 'build'){
plugins.push(
new webpack.optimize.UglifyJsPlugin({
sourceMap:true
})
);
}
module.exports = {
entry: './src/' + libraryName + '.js',
output: {
filename: libraryName + '.min.js',
path: BUILD_PATH,
library: libraryName,
libraryTarget: 'umd',
umdNamedDefine: true
},
devtool: 'source-map',
devServer: {
publicPath: '/dist/'
},
module: {
rules: [
{
test: /\.js$/,
include: DEV_PATH,
loader: 'babel-loader',
options: {
presets: ['es2015']
}
},
{
test: /\.scss$/,
include: DEV_PATH,
use: [
'style-loader',
'css-loader',
'sass-loader'
]
}
]
},
plugins: plugins
};