forked from martyan/react-customizable-progressbar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.prod.js
61 lines (59 loc) · 1.85 KB
/
webpack.config.prod.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 TerserPlugin = require('terser-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const path = require('path');
const SRC_PATH = path.resolve(__dirname, 'src');
const DIST_PATH = path.resolve(__dirname, 'dist');
module.exports = [
{
mode: 'production',
target: 'web',
context: SRC_PATH,
devtool: false,
entry: [/*'@babel/polyfill', */'./ReactCustomizableProgressbar'],
output: {
path: DIST_PATH,
filename: 'ReactCustomizableProgressbar.js',
library: 'ReactCustomizableProgressbar',
libraryTarget: 'umd',
globalObject: 'this'
},
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx']
},
module: {
rules: [
{
test: /\.tsx?$/,
exclude: /node_modules/,
loader: 'ts-loader'
},
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
options: {
presets: [['@babel/preset-env', { modules: false }], '@babel/preset-react'],
plugins: [
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-object-rest-spread'
]
}
}
]
},
externals: {
react: 'react'
},
plugins: [
new webpack.EnvironmentPlugin({
NODE_ENV: 'production'
}),
new CleanWebpackPlugin(DIST_PATH)
],
optimization: {
minimize: true,
minimizer: [new TerserPlugin()]
}
}
];