Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Awesome Typescript Loader in config-overrides.js #4

Open
mitchelldemler opened this issue Jan 15, 2018 · 0 comments
Open

Awesome Typescript Loader in config-overrides.js #4

mitchelldemler opened this issue Jan 15, 2018 · 0 comments

Comments

@mitchelldemler
Copy link

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',
    };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant