forked from awslabs/diagram-maker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.prod.js
51 lines (49 loc) · 1.38 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
47
48
49
50
51
const baseConfig = require('./webpack.common.js');
const path = require('path');
const merge = require('webpack-merge').merge;
const BundleDeclarationsWebpackPlugin = require('bundle-declarations-webpack-plugin').default;
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CssMinimizerPlugin = require("css-minimizer-webpack-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: 'diagramMaker.js',
path: path.resolve(__dirname, 'dist'),
library: 'diagramMaker',
libraryTarget: 'umd',
umdNamedDefine: true
},
externals: {
'dagre': 'dagre'
},
optimization: {
minimizer: [
`...`,
new CssMinimizerPlugin(),
],
},
plugins: [
// Extract all CSS
new MiniCssExtractPlugin({
filename: 'diagramMaker.css'
}),
new BundleDeclarationsWebpackPlugin({
entry: {
filePath: 'src/index.ts',
libraries: {
inlinedLibraries: ['redux']
},
output: {
inlineDeclareGlobals: true
}
},
outFile: 'diagramMaker.d.ts'
})
],
// This is because of a limitation in ts-loader
// https://github.com/TypeStrong/ts-loader#transpileonly-boolean-defaultfalse
ignoreWarnings: [/export .* was not found in/]
});