我正在使用browserify打包我的应用程序并使用js文件作为模块。
现在我想使用webworker在后台上传一个非常大的文件。
我遇到的问题是要为这个工人创建指令
new Worker('./worker.js')必须收到js文件的名称。 这样该文件不能成为模块。 我认为这使得我的应用程序变得更加复杂,因为现在我必须结合使用js文件的两种方式。
另一方面,我也有兴趣从这个worker访问browserify模块。
所以问题是,将browserify和Web worker一起使用的最佳方法是什么?
I'm using browserify to pack my app and use js files as modules.
Now I want to use a webworker to upload a very big file on the background.
The problem I have is that to create this worker the instruction
new Worker('./worker.js')must receive the name of a js file. So that this file cannot be a module. I think that this makes my app much more complicated, because now I have to combine two ways of using js files.
On the other hand, I'm interested in accessing a browserify module from this worker too.
So the question is, Which is the best way of using browserify and web workers together?
最满意答案
您可以使用webworkify来处理此问题
You can use webworkify to handle this
更多推荐
发布评论