const path = require('path');
const d = require(process.env.SCRYPTED_DEFAULT_WEBPACK_CONFIG);

d.resolveLoader = {
    modules: [...d.resolveLoader.modules, path.join(__dirname, 'node_modules')],
}

// emscripten detects node which does not provide a functional worker_threads in electron.
// this causes tfjs wasm threads to fail.
// hot patch the file to force it to use browser workers.
d.module.rules.push(
    {
        loader: 'string-replace-loader',
        options: {
            search: 'var ENVIRONMENT_IS_NODE=',
            replace: 'var ENVIRONMENT_IS_NODE=false && ',
        }
    }
);

module.exports = d;
