I have a React app created with create-react-app, not ejected. I'm trying to use web workers. I've tried the worker-loader package (https://github.com/webpack-contrib/worker-loader).
If I try worker-loader out of the box (import Worker from 'worker-loader!../workers/myworker.js';
), I get the error message telling me that Webpack loaders are not supported by Create React App, which I already know.
Would the solution be to eject the app (which I'd prefer not to do) and edit the webpack.config.js or is there some other way of using web workers inside a React app?
EDIT: I have found the solution here: https://github.com/facebookincubator/create-react-app/issues/1277 (post by yonatanmn)
See Question&Answers more detail:os