【发布时间】:2019-10-10 10:55:39
【问题描述】:
我正计划编写一个用于分发的打字稿库,这将取决于cephes。
为了在浏览器中使用 Web 程序集,我们必须像这样编译它:
const cephes = require('cephes'); // Browser
await cephes.compiled;
我不确定如何为包装 cephes 的 Typescript 库实现此功能。
例如,库将提供一个 NormalDistribution,可以像这样导入:
import { NormalDistrbution } from 'cephesdistributions';
如果我们进行树摇动,那么 NormalDistribution 可能是包中包含的唯一导入。因此,我们是否需要在cephesdistributions 提供的所有模块中包含await cephes.compiled?
【问题讨论】:
标签: javascript typescript browser webassembly