简体   繁体   English

如何使用worker-loader配置创建react应用

[英]how to config create react app with worker-loader

I need to create an CRA(create-react-app) app with multiple workers. 我需要使用多个工作人员创建一个CRA(create-react-app)应用程序。 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. 我想要一个能满足上述要求的简单的create react app。

currently I see: 目前我看到:

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

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM