comlink-loader Webpack加载器使用Comlink将模块卸载到Worker线程
说到把模块卸载到 Worker 线程,comlink-loader真的是一个挺好用的工具。它能让你几乎不改变代码的情况下,把大部分模块移到 Worker 中。支持几乎所有类、对象和函数,async/await的搭配也流畅。安装后,只需要做两步小改动,就能用它在 Worker 中导入类、实例化对象,简直不要太方便。哦,而且它还内置了代码拆分功能,Worker 会在需要时才加载,性能优化杠杠的。使用起来也蛮简单,推荐试试!
你只需运行npm install -D comlink-loader
,在 Webpack 配置中加上相关内容,就可以通过comlink-loader
把模块轻松卸载到 Worker 中。如果你对 Worker 和async/await
有一些需求,使用这个工具会让你的开发更加高效。
comlink-loader-master.zip
预估大小:13个文件
comlink-loader-master
文件夹
.gitignore
112B
README.md
4KB
test
文件夹
index.test.js
2KB
worker.js
937B
singleton.test.js
2KB
other.js
655B
LICENSE
11KB
package.json
2KB
13.75KB
文件大小:
评论区