-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathwebpack.config.js
56 lines (53 loc) · 1.3 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
53
54
55
56
const path = require("path");
const TerserWebpackPlugin = require("terser-webpack-plugin");
const mode = process.env.NODE_ENV || "development";
module.exports = {
mode: mode,
entry: {
party: "./src/index.ts",
"party.min": "./src/index.ts",
},
output: {
path: path.resolve(__dirname, "bundle"),
filename: "[name].js",
libraryTarget: "umd",
library: "party",
umdNamedDefine: true,
libraryExport: "default",
},
module: {
rules: [
{
test: /\.ts$/,
use: "ts-loader",
exclude: /node_modules/,
},
],
},
resolve: {
extensions: [".ts", ".js"],
},
devtool: mode == "development" ? "source-map" : "none",
plugins: [
new TerserWebpackPlugin({
test: /\.min\.js$/,
terserOptions: {
format: {
comments: false,
},
},
extractComments: false,
}),
],
stats: "errors-only",
devServer: {
static: {
directory: path.resolve(__dirname, "samples"),
watch: true,
},
watchFiles: ["src/**/*.ts"],
magicHtml: true,
compress: true,
port: 9000,
},
};