当运行我的包时,我得到这个错误:
can't access property "call", Readable$1 is undefined
所以我查看了捆绑的代码,并在71481行注意到了以下内容:
function Duplex$2(options) {
if (!(this instanceof Duplex$2)) return new Duplex$2(options);
Readable$1.call(this, options);on line 71463 (在使用前正确使用):
var Readable$1 = _stream_readable;但是在第72148行(所以可读的$1在这一点上实际上是未定义的,它链接到上面的错误):
var _stream_readable = Readable;
/*<replacement>*/如果我手动将这个定义移到var Readable$1 = _stream_readable;之前,它就可以工作了。我的问题是,我如何解决汇总混淆了顺序?
发布于 2021-10-07 16:48:15
好的,这是一个关于rollup和可读流的已知问题,正如这里指出的:https://github.com/rollup/rollup/issues/4231,并在列出的各种问题中记录:https://github.com/rollup/rollup/issues/4231#issuecomment-937772340
我设法用这种方式解决了这个问题:https://github.com/nodejs/readable-stream/issues/348#issuecomment-937971694,基本上:
npm i readable-stream@npm:vite-compatible-readable-stream
这里详细介绍了相关的概念:https://github.com/nodejs/readable-stream/issues/348#issuecomment-473804926
https://stackoverflow.com/questions/69165942
复制相似问题