-
Notifications
You must be signed in to change notification settings - Fork 56
/
webpack.config.js
55 lines (52 loc) · 1.47 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
const path = require("path");
const webpack = require("webpack");
const build_type = process.env.BUILD_TYPE || "";
console.log("build_type::", build_type);
const manager = {
// mode: "development",
mode: "production",
entry: "./src/face-landmark-detection-worker.ts",
resolve: {
extensions: [".ts", ".js"],
fallback: {
crypto: false,
path: false,
fs: false,
buffer: require.resolve("buffer/"),
},
},
module: {
rules: [
{
test: /\.ts$/,
use: [
{ loader: "ts-loader" },
{
loader: "ifdef-loader",
options: {
BUILD_TYPE: build_type,
},
},
],
},
{ test: /resources\/.*\.bin/, type: "asset/inline" },
{ test: /resources\/.*\.json/, type: "asset/source" },
{ test: /\.wasm$/, type: "asset/inline" },
],
},
output: {
filename: `face-landmark-detection-worker${build_type}.js`,
path: path.resolve(__dirname, "dist"),
libraryTarget: "umd",
globalObject: "typeof self !== 'undefined' ? self : this",
},
stats: {
children: true,
},
plugins: [
new webpack.ProvidePlugin({
Buffer: ["buffer", "Buffer"],
}),
],
};
module.exports = [manager];