-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.js
52 lines (48 loc) · 1.11 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
const path = require('path');
const webpack = require('webpack');
const merge = require('webpack-merge');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const env = process.env.NODE_ENV || 'development';
const commons = {
context: path.join(__dirname, 'src'),
entry: [ 'babel-polyfill', './index.js' ],
output: {
library: [ 'mysam', 'ui' ],
libraryTarget: 'umd',
filename: path.join('dist', 'mysam-ui.js')
},
module: {
rules: [{
test: /\.jsx?$/,
exclude: /node_modules\/(?!(@feathersjs|feathers|mysam|debug))/,
loader: 'babel-loader'
}]
},
node: {
fs: 'empty'
}
};
const dev = {
mode: 'development',
devtool: 'source-map',
devServer: {
port: 3030,
contentBase: '.',
compress: true
}
};
const production = {
mode: 'production',
output: {
filename: path.join('dist', 'mysam-ui.min.js')
},
plugins: [
new UglifyJSPlugin({
sourceMap: false
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
})
]
};
module.exports = merge(commons, env !== 'development' ? production : dev);