Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Awesome Typescript Loader in config-overrides.js #4

@mitchelldemler

Description

@mitchelldemler

FYI I had to update my config-overrides.js after updating to the latest version of react-scripts-ts. It seems the webpack config is using the new structure.

Not sure if there's a nicer way to express this:

const oneOf = config.module.rules.find((conf) => {
        return conf.oneOf;
    }).oneOf;
    const rule = oneOf.find((conf) => {
        return (
            conf.use &&
            conf.use.find((use) => {
                return use.loader && use.loader.includes('ts-loader');
            })
        );
    });
    const tsLoader = rule.use[0]; // this doesn't feel right.
    tsLoader.loader = require.resolve('awesome-typescript-loader');
    tsLoader.options = {
        useBabel: true,
        useCache: true,
        errorsAsWarnings: env === 'development',
    };

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions