{"size": 1105, "ext": "js", "max_stars_repo_path": "react-app-rewired.config.js", "max_stars_repo_name": "figurantpp/ibfi", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "react-app-rewired.config.js", "max_issues_repo_name": "figurantpp/ibfi", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "react-app-rewired.config.js", "max_forks_repo_name": "figurantpp/ibfi", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.6976744186, "max_line_length": 92, "alphanum_fraction": 0.5484162896}
// credit: https://github.com/dominique-mueller/create-react-app-typescript-web-worker-setup

/**
 * React App Rewired Config
 */
// @ts-ignore
module.exports = (config) => {

    config.module.rules.unshift({
        test: /\.worker\.ts$/,
        use: {
            loader: 'worker-loader',
            options: {
                filename: 'static/js/[name].[contenthash:8].js',
            },
        },
    });

    const path = require('path');

    const wasmExtensionRegExp = /\.wasm$/;

    config.resolve.extensions.push('.wasm');

    config.module.rules.forEach(rule => {
        (rule.oneOf || []).forEach(oneOf => {
            if (oneOf.loader && oneOf.loader.indexOf('file-loader') >= 0) {
                // make file-loader ignore WASM files
                oneOf.exclude.push(wasmExtensionRegExp);
            }
        });
    });

    // add a dedicated loader for WASM
    config.module.rules.push({
        test: wasmExtensionRegExp,
        include: path.resolve(__dirname, 'src'),
        use: [{loader: require.resolve('wasm-loader'), options: {}}]
    });

    return config;
};
