-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathwebpack.config.js
52 lines (50 loc) · 1.32 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
45
46
47
48
49
50
51
52
const webpack = require('webpack');
const path = require('path');
const LicensePlugin = require('webpack-license-plugin')
const TerserPlugin = require('terser-webpack-plugin');
const defaultConfig = {
entry: './src/main.ts',
module: {
rules: [
{
test: /\.tsx?$/,
use: [
{loader: 'expose-loader', options: { exposes: [{globalName: 'TNA', override: true}]}},
{loader: 'ts-loader', options: {onlyCompileBundledFiles: true}}
],
include: /src/,
},
],
},
resolve: {
extensions: [ '.ts', '.ts', '.js' ],
},
};
module.exports = [
{
...defaultConfig,
mode: 'development',
devtool: 'source-map',
output: {
filename: 'network-animator.js',
path: path.resolve(__dirname, 'dist'),
},
},
{
...defaultConfig,
mode: 'production',
output: {
filename: 'network-animator.min.js',
path: path.resolve(__dirname, 'dist'),
},
optimization: {
minimizer: [new TerserPlugin({
extractComments: false,
})],
},
plugins: [
new LicensePlugin({ outputFilename: 'network-animator.LICENSES.json' }),
new webpack.BannerPlugin({banner: 'https://github.com/traines-source/transport-network-animator MIT License. For vendor licenses, please see network-animator.LICENSES.json'})
],
},
];