-
-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathwebpack.config.js
More file actions
60 lines (57 loc) · 1.42 KB
/
Copy pathwebpack.config.js
File metadata and controls
60 lines (57 loc) · 1.42 KB
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
57
58
59
60
import webpack from "webpack";
import TerserPlugin from "terser-webpack-plugin";
import fs from "fs";
const packageJson = JSON.parse(fs.readFileSync("./package.json"));
const license =
"/* Copyright 2021-2025 Ethan Halsall. This file is part of wasm-audio-decoders. https://github.com/eshaz/wasm-audio-decoders */";
export default {
mode: "production",
devtool: "source-map",
entry: "/index.js",
output: {
path: new URL("dist", import.meta.url).pathname,
filename: `${packageJson.name}.min.js`,
chunkFilename: `${packageJson.name}.[name].min.js`,
library: "ogg-opus-decoder",
libraryTarget: "umd",
globalObject: "this",
},
plugins: [new webpack.ProgressPlugin()],
resolve: {
fallback: { util: false },
},
module: {
rules: [],
},
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
terserOptions: {
module: true,
ecma: 2021,
safari10: true,
output: {
preamble: license,
},
compress: {
ecma: 2021,
passes: 5,
toplevel: true,
unsafe: true,
unsafe_methods: true,
unsafe_arrows: true,
},
mangle: {
module: true,
properties: {
keep_quoted: "strict",
debug: false,
regex: /^_/,
},
},
},
}),
],
},
};