Skip to content

Support worker-loader and report errors in child loaders #8765

@nickretallack

Description

@nickretallack

Is your proposal related to a problem?

If you try to use worker-loader in your webpack config, either by ejecting or by patching it into react-scripts/config/webpack.conf.js by other means, and there are any eslint errors in your worker files, your build will pretend to succeed but it will produce no build files other than a copy of the public directory.

This is because react-scripts doesn't report errors in child loaders. A PR was created to address this a year ago but it still hasn't been merged.. This was originally reported as a problem with using workerize-loader in your project. That issue seems to have been closed prematurely because the related PR never got merged. I haven't used workerize-loader, but I've heard there are some issues with using it in your webpack config as well.

Describe the solution you'd like

Merge the PR. Handle errors in child loaders.

Also, it'd be nice if I could use worker-loader without ejecting or patching react-scripts. I mention that in the same issue because it's a concrete repro case for the issue I'm talking about here. I don't know what a solution to this would look like, but if there could be some blessed way to add plugins without ejecting that'd be great. Or create-react-app could ship with configuration for common ones, and enable that configuration if the relevant packages happened to be installed.

Describe alternatives you've considered

I'm already patching this change into my own project because it's really bad for a build system to think it succeeded but not produce a build. I used patch-package to edit the build script without ejecting. I also used patch-package to add worker-loader to my webpack config.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions