forked from 0xcadams/react-dropzone-uploader
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.build.config.js
More file actions
77 lines (71 loc) · 2.14 KB
/
Copy pathwebpack.build.config.js
File metadata and controls
77 lines (71 loc) · 2.14 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/* eslint import/no-extraneous-dependencies: 0 */
const TerserPlugin = require("terser-webpack-plugin");
const path = require('path')
const CopyPlugin = require("copy-webpack-plugin");
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 TerserPlugin()],
},
module: {
rules: [
{
test: /\.tsx?$/,
use: [
{
loader: 'ts-loader',
}
]
},
{
test: /\.css$/,
use: [{loader: 'style-loader'}]
},
{
test: /\.(png|jpg|jpeg|gif|svg|woff|woff2)$/,
use: [
{
loader: 'url-loader',
options: {
limit: 10000,
exclude: /node_modules/,
}
}
]
},
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js', '.js']
},
plugins: [
new CopyPlugin({
patterns: [
"src/styles.css",
{from: "src/assets/cancel.svg", to: "assets"},
{from: "src/assets/remove.svg", to: "assets"},
{from: "src/assets/restart.svg", to: "assets"},
]
}),
]
}
}
module.exports = [
createConfig('./src/Dropzone.tsx', {
path: path.resolve('dist'),
libraryTarget: 'commonjs2',
filename: 'react-dropzone-uploader.js',
}),
createConfig('./src/Dropzone.tsx', {
path: path.resolve('dist'),
libraryTarget: 'umd',
filename: 'react-dropzone-uploader.umd.js',
library: 'ReactDropzoneUploader',
}),
]