andywer/threads-plugin

npx create-react-app with react-app-rewired not finding Workers

Opened this issue · 0 comments

I've created a React project with npx create-react-app and am attempting to use the threads-plugin with react-app-rewired. When I call npm start I get the following warning

WARNING in No instantiations of threads.js workers found.
Please check that:
  1. You have configured Babel / TypeScript to not transpile ES modules
  2. You import `Worker` from `threads` where you use it

For more details see: https://github.com/andywer/threads-plugin

When I attempt to use the worker it errors out with the error

Uncaught SyntaxError: Unexpected token '<'

which I think it due to the plugin not packaging the worker correctly and the call to retrieve the JS is returning HTML.

I've created an example project here - https://github.com/qsc-jhndnn/thread-test.