const path = require("path");

const manager = {
    mode: "development",
    // mode: "production",
    entry: "./src/hand-pose-detection-worker.ts",
    resolve: {
        extensions: [".ts", ".js"],
        fallback: {
            crypto: false,
            path: false,
            fs: false,
        },
    },
    module: {
        rules: [
            { test: /\.ts$/, loader: "ts-loader" },
            { test: /resources\/.*\.bin/, type: "asset/inline" },
            { test: /resources\/.*\.json/, type: "asset/source" },
            { test: /\.wasm$/, type: "asset/inline" },
        ],
    },
    output: {
        filename: "hand-pose-detection-worker.js",
        path: path.resolve(__dirname, "dist"),
        libraryTarget: "umd",
        globalObject: "typeof self !== 'undefined' ? self : this",
    },
    stats: {
        children: true,
    },
};

module.exports = [manager];
