This repository has been archived by the owner on May 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
webpack.prod.js
46 lines (44 loc) · 1.28 KB
/
webpack.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
const baseConfig = require('./webpack.common.js');
const path = require('path');
const merge = require('webpack-merge').merge;
const DeclarationBundlePlugin = require('./DeclarationBundlePlugin.js');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
// TODO: We can add a threshold on the asset size in our build setp here.
module.exports = merge(baseConfig, {
mode: 'production',
devtool: 'source-map',
bail: true,
output: {
filename: 'diagramMakerMinimap.js',
path: path.resolve(__dirname, 'dist'),
library: 'diagramMakerMinimap',
libraryTarget: 'umd',
umdNamedDefine: true
},
externals: {
'react': 'react',
'react-dom' : 'react-dom',
'diagramMaker' : 'diagramMaker'
},
optimization: {
minimize: true,
minimizer: [
new CssMinimizerPlugin(),
]
},
plugins: [
// Extract all CSS
new MiniCssExtractPlugin({
filename: 'diagramMakerMinimap.css'
}),
new DeclarationBundlePlugin({
name: 'diagramMakerMinimap.d.ts'
}),
],
stats: {
// This is because of a limitation in ts-loader
// https://github.com/TypeStrong/ts-loader#transpileonly-boolean-defaultfalse
warningsFilter: /export .* was not found in/
}
});