-
Notifications
You must be signed in to change notification settings - Fork 56
/
webpack.config.js
56 lines (51 loc) · 1.9 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 webpack = require("webpack");
const manager = {
// mode: "development",
mode: "production",
entry: "./src/index.ts",
resolve: {
extensions: [".ts", ".js"],
fallback: {
crypto: false,
path: false,
fs: false,
buffer: require.resolve("buffer/"),
},
},
module: {
rules: [
{
test: /\.ts$/,
use: [{ loader: "ts-loader" }],
},
// { test: /\.bin$/, type: "asset/resource" },
// { test: /\.wasm$/, type: "asset/resource" },
],
},
externals: {
"./resources/wasm/tflite-simd.wasm": "commonjs ./resources/wasm/tflite-simd.wasm",
"./resources/tflite/detector/palm_detection_lite.bin": "commonjs ./resources/tflite/detector/palm_detection_lite.bin",
"./resources/tflite/landmark/hand_landmark_lite.bin": "commonjs ./resources/tflite/landmark/hand_landmark_lite.bin",
"./resources/tflite/detector/face_detection_short_range.bin": "commonjs ./resources/tflite/detector/face_detection_short_range.bin",
"./resources/tflite/landmark/model_float16_quant.bin": "commonjs ./resources/tflite/landmark/model_float16_quant.bin",
"./resources/tflite/detector/pose_detection.bin": "commonjs ./resources/tflite/detector/pose_detection.bin",
"./resources/tflite/landmark/pose_landmark_lite.bin": "commonjs ./resources/tflite/landmark/pose_landmark_lite.bin",
"": "commonjs ",
},
output: {
filename: `index.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];