webpack.config.js
785 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
const path = require('path');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const plugins = [];
let devtool;
if (process.argv.some(a => a === '--report')) {
plugins.push(new BundleAnalyzerPlugin());
}
if (process.argv.some(a => a === 'development')) {
devtool = 'source-map';
}
module.exports = {
entry: './src/index.ts',
mode: 'production',
devtool,
output: {
path: path.join(__dirname, '../dist'),
filename: 'apm.js',
libraryTarget: 'umd',
library: 'apm'
},
resolve: {
extensions: ['.ts', '.js'],
modules: [
'node_modules'
]
},
module: {
rules: [
{
test: /\.(ts|js)x?$/,
exclude: /node_modules/,
loader: 'babel-loader'
}
]
},
plugins
};