从 UMD 模块命名导入(不是应该在浏览器中工作的 UMD,而 Deno 似乎类似于浏览器?):
import { range } from "https://unpkg.com/@reactivex/rxjs@6.6.3/dist/global/rxjs.umd.js";
import { operators } from "https://unpkg.com/@reactivex/rxjs@6.6.3/dist/global/rxjs.umd.js";
结果是
error: Uncaught SyntaxError: The requested module 'https://unpkg.com/@reactivex/rxjs@6.6.3/dist/global/rxjs.umd.js' does not provide an export named 'operators'
error: Uncaught SyntaxError: The requested module 'https://unpkg.com/@reactivex/rxjs@6.6.3/dist/global/rxjs.umd.js' does not provide an export named 'range'
也直接从 ES2015 导入
import { range } from "https://unpkg.com/@reactivex/rxjs@6.6.3/dist/esm2015/index.js";
import { filter, map } from "https://unpkg.com/@reactivex/rxjs@6.6.3/dist/esm2015/operators/index.js";
似乎正在工作,加载了很多内部模块然后崩溃:
Download https://unpkg.com/@reactivex/rxjs@6.6.3/dist/esm2015/internal/observable/fromEvent
/// downloads 150 internal modules
Download https://unpkg.com/@reactivex/rxjs@6.6.3/dist/esm2015/internal/util/Immediate.js // 5 minutes later
error: Import 'https://unpkg.com/@reactivex/rxjs@6.6.3/dist/esm2015/internal/symbol/observable.js' failed: 500 Internal Server Error
at https://unpkg.com/@reactivex/rxjs@6.6.3/dist/esm2015/index.js:4:0
RxJS 似乎是一个维护得相当好的库 - 我不认为它的打包不正确,但由于它确实开始下载内部 es2015 模块,我假设导入正确完成
更新:UMD 的使用仍未解决,仍不清楚“dist/global/rxjs.umd.js”如何工作