how to config create react app with worker-loader
Asked Answered
S

1

7

I need to create an CRA(create-react-app) app with multiple workers. As an example (my workers include import modules):

// worker.js
import x from 'file-xxx.js'
addEventListener('message', e => {
   // ...
})
// App.jsx

App(){
   const mWorker = new Worker('./worker') 
   mWorker.postMessage('data...')

   // ...

}

I would like if one help me to construct a simple create react app with above mentioned requirement.

currently I see:

-- https://webpack.js.org/loaders/worker-loader/

-- https://github.com/GoogleChromeLabs/comlink

-- https://github.com/GoogleChromeLabs/worker-plugin

Showiness answered 29/7, 2019 at 8:47 Comment(0)
S
0

can see the following link: https://github.com/arackaf/customize-cra/issues/137

example of usage: https://github.com/YumcoderCom/yumgram/blob/master/config-overrides.js

Showiness answered 22/8, 2019 at 9:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.