-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.js
More file actions
45 lines (42 loc) · 989 Bytes
/
webpack.config.js
File metadata and controls
45 lines (42 loc) · 989 Bytes
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
/*
* GPLv3 https://www.gnu.org/licenses/gpl-3.0.en.html
*
* Author: eidng8
*/
const path = require('path');
const WBA = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const BundleAnalyzerPlugin = require('@bundle-analyzer/webpack-plugin');
const plugins = [];
if (process.env.WBA) {
plugins.push(new WBA({ analyzerMode: 'static' }));
}
if (process.env.BUNDLE_ANALYZER_TOKEN) {
plugins.push(
new BundleAnalyzerPlugin({ token: process.env.BUNDLE_ANALYZER_TOKEN }),
);
}
module.exports = {
mode: 'production',
entry: {
index: './src/index.ts',
},
output: {
path: path.resolve(__dirname, 'lib'),
filename: '[name].js',
libraryTarget: 'commonjs',
},
resolve: {
extensions: ['.ts', '.tsx', '.js'],
},
externals: ['fs', 'iconv-lite', 'pretty-data', 'xmldom-ts', 'xpath-ts'],
module: {
rules: [
{
test: /\.ts$/,
loader: 'babel-loader',
exclude: [/node_modules/],
},
],
},
plugins,
};