-
Notifications
You must be signed in to change notification settings - Fork 7
/
webpack.config.js
61 lines (57 loc) · 1.41 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
59
60
61
const webpack = require('webpack');
const path = require('path');
var WebpackBundleSizeAnalyzerPlugin = require('webpack-bundle-size-analyzer').WebpackBundleSizeAnalyzerPlugin;
const prod = process.env.NODE_ENV === 'production';
const externals = [];
if (prod) {
externals.push([
'material-ui',
'material-ui/Chip',
'material-ui/styles',
'material-ui/Form',
'material-ui/Input',
'material-ui/Menu',
'material-ui/Paper',
'classnames',
'prop-types',
'react',
'react-dom',
]);
}
module.exports = {
devtool: 'cheap-module-source-map',
entry: './src/MaterialChips/index.js',
target: prod ? 'node' : 'web',
output: {
path: path.resolve(__dirname, 'dist'),
libraryTarget: 'umd',
filename: 'material-input-chips.js'
},
module: {
rules: [
{
enforce: 'pre',
test: /\.js$/,
include: path.join(__dirname, 'src'),
loader: 'eslint-loader'
},
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader'
}
}
]
},
externals,
plugins: [
new WebpackBundleSizeAnalyzerPlugin(path.resolve(__dirname, 'dist/plain-report.txt')),
// prod && new webpack.optimize.UglifyJsPlugin({
// minimize: true,
// compress: {
// warnings: false
// }
// }),
]
}