developit/workerize-loader

Create React App build creates empty folder

carapai opened this issue · 3 comments

Building the app creates an empty folder while using workerize-loader

You probably have a webpack error in your worker file. The console.log hint below should be helpful.

facebook/create-react-app#8014 (comment)

Indeed - this is a bug in CRA, so I'll close out this issue. Hopefully facebook/create-react-app#6286 gets merged soon!

You probably have a webpack error in your worker file. The console.log hint below should be helpful.

facebook/create-react-app#8014 (comment)

The above was helpful in figuring out what was wrong, if you want to avoid branching and ejecting, the error could be a simple ESLint warning as well.

In my case, the error was ESLint being upset with me using self.postMessage() within the worker file.

ESLint would provide the following error Unexpected use of 'self'.eslint(no-restricted-globals) in VSCode. When the CRA bug above is fixed it will show up in the console and fail the build and you won't spend a bunch of time trying to figure out why the build silently failed.

My temporary fix was to add disable the ESLint rule for my workerfile as I wasn't sure how to do it correctly...

/* eslint-disable no-restricted-globals */