-
Notifications
You must be signed in to change notification settings - Fork 4
/
webpack.config.js
53 lines (48 loc) · 1.22 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
/**
* Created by jyothi on 21/4/17.
*/
const webpack = require('webpack');
const UglifyJsPlugin = webpack.optimize.UglifyJsPlugin;
const path = require('path');
const env = require('yargs').argv.env; // use --env with webpack 2
const libraryName = 'Camera';
const libraryFileName = 'camera';
let plugins = [], outputFile;
if (env === 'build') {
plugins.push(new UglifyJsPlugin({ minimize: true }));
outputFile = libraryFileName + '.min.js';
} else {
outputFile = libraryFileName + '.js';
}
module.exports = {
entry: './src/index.js',
output: {
path: __dirname + '/lib',
filename: outputFile,
library: libraryName,
libraryTarget: 'umd'
},
resolve: {
modules: [path.resolve('./src')],
extensions: ['.js']
},
module: {
loaders: [
{
test: /\.js$/,
loader: ['babel-loader?presets[]=es2015,presets[]=stage-0'],
exclude: /(node_modules|bower_components)/
},
{
test: /\.html$/,
loader: 'raw'
}
]
},
devServer: {
contentBase: '.',
port: 3456,
inline: true
},
plugins: plugins
};