-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.ts
45 lines (42 loc) · 1.04 KB
/
webpack.config.ts
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
import TerserPlugin from "terser-webpack-plugin";
import { BannerPlugin, Configuration } from "webpack";
import nodeExternals from "webpack-node-externals";
import { homepage, license, name, version } from "./package.json";
const [, filename] = name.split("/");
const now = new Date().toISOString().substring(0, 10);
export default [false, true].map<Configuration>(minimize => ({
devtool: "source-map",
entry: "./src/index.ts",
externals: [nodeExternals()],
mode: "production",
module: {
rules: [
{
exclude: /node_modules/,
test: /\.ts$/,
use: [
{
loader: "ts-loader",
options: {
configFile: "tsconfig.webpack.json"
}
}
]
}
]
},
optimization: {
minimize,
minimizer: [new TerserPlugin({ extractComments: false })]
},
output: {
filename: `bundles/${filename}.umd${minimize ? ".min" : ""}.js`,
library: { type: "umd" }
},
plugins: [
new BannerPlugin(
`${name} v${version} | License: ${license} | Page: ${homepage} | Date: ${now}`
)
],
resolve: { extensions: [".ts", ".js"] }
}));