-
Notifications
You must be signed in to change notification settings - Fork 8
/
webpack.config.js
44 lines (41 loc) · 1.11 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
const path = require('path');
const TerserPlugin = require("terser-webpack-plugin");
const MINIFY = process.env.MINIFY === "YES";
const rules = [{
test: /\.tsx?$/,
exclude: /node_modules/,
use: ['ts-loader'],
}, {
test: /\.css$/,
use: ["style-loader", "css-loader"],
}];
module.exports = {
mode: MINIFY ? "production" : "development",
devtool: 'source-map',
entry: './src/index',
output: {
path: path.join(__dirname, 'umd'),
library: 'MobxReactFormDevTools',
libraryTarget: 'umd',
filename: MINIFY ? "MobxReactFormDevTools.umd.min.js" : "MobxReactFormDevTools.umd.js",
},
resolve: {
modules: [path.resolve(__dirname, 'node_modules')],
extensions: ['', '.js', '.ts', '.tsx', '.json'],
alias: {
mobx: path.resolve(__dirname, 'node_modules/mobx'),
// 'react-icons': path.resolve(__dirname, 'node_modules/react-icons'),
},
},
externals: {
'mobx-react-form': 'mobx-react-form',
'mobx-react': 'mobx-react',
'react': 'react',
'mobx': 'mobx',
},
optimization: {
minimize: MINIFY,
minimizer: [new TerserPlugin()],
},
module: { rules },
};