forked from intel/webml-polyfill
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
34 lines (31 loc) · 873 Bytes
/
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
const path = require('path');
const webpack = require('webpack')
const config = {
entry: ['./src/WebMLPolyfill.js'],
output: {
filename: 'webml-polyfill.js',
path: path.resolve(__dirname, 'dist')
},
module: {
rules: [{ test: /\.js$/, loader: 'babel-loader', exclude: /node_modules/ }]
},
resolve: {
extensions: ['.js']
},
externals: {
'fs': true
}
};
if (process.env.NODE_ENV === 'production') {
config.plugins = [
new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify('production') }),
new webpack.optimize.ModuleConcatenationPlugin(),
new webpack.optimize.UglifyJsPlugin({
compress: { warnings: false, unused: false },
output: { comments: false }
})
]
} else {
config.plugins = [new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify('development') })]
}
module.exports = config