forked from fortana-co/react-dropzone-uploader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.build.config.js
50 lines (47 loc) · 1.17 KB
/
webpack.build.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
/* eslint import/no-extraneous-dependencies: 0 */
const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
const path = require('path')
if (process.env.NODE_ENV !== 'production') {
throw new Error('Production builds must have NODE_ENV=production.')
}
function createConfig(entry, output) {
return {
mode: 'production',
entry,
output,
optimization: {
minimizer: [new UglifyJSPlugin()],
},
module: {
rules: [
{
test: /\.js?$/,
exclude: /node_modules/,
use: 'babel-loader',
},
{
test: /\.css$/,
loaders: ['style-loader', 'css-loader'],
},
{
test: /\.(png|jpg|jpeg|gif|svg|woff|woff2)$/,
exclude: /node_modules/,
loader: 'url-loader?limit=10000',
},
],
},
}
}
module.exports = [
createConfig('./src/Dropzone.js', {
path: path.resolve('dist'),
libraryTarget: 'commonjs2',
filename: 'react-dropzone-uploader.js',
}),
createConfig('./src/Dropzone.js', {
path: path.resolve('dist'),
libraryTarget: 'umd',
filename: 'react-dropzone-uploader.umd.js',
library: 'ReactDropzoneUploader',
}),
]