-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathwebpack.config.js
More file actions
52 lines (50 loc) · 1.27 KB
/
webpack.config.js
File metadata and controls
52 lines (50 loc) · 1.27 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
/**
* Webpack config to bundle WasmWebTerm
* Generates the files "dist/wasm-webterm.js" and "dist/wasm-webterm.js.map"
*/
const webpack = require("webpack")
module.exports = {
entry: { WasmWebTerm: "./src/WasmWebTerm.js" },
output: {
path: __dirname + "/dist/",
filename: "wasm-webterm.js",
library: { type: "umd", name: "[name]" },
},
target: ["web", "es2015"],
optimization: {
moduleIds: "deterministic", // share deterministic ids with the worker bundle
},
plugins: [
new webpack.ProvidePlugin({
Buffer: ["buffer", "Buffer"],
process: "process/browser",
}),
new webpack.DefinePlugin({
__VERSION__: JSON.stringify(process.env.npm_package_version),
}),
],
module: {
rules: [
{
test: __dirname + "/src/runners/WasmWorker.js",
use: [{ loader: "worker-loader" }],
type: "asset/source",
},
{
test: /\.m?js$/,
include: [__dirname + "/src"],
exclude: /\bnode_modules\b/,
use: [
{
loader: "swc-loader",
options: { minify: true, jsc: { target: "es2015" } },
},
],
},
],
},
resolveLoader: {
alias: { "worker-loader": __dirname + "/worker.loader.js" },
},
devtool: "source-map",
}