Failed to import - fetch-blob
Failing module
- GitHub: https://github.com/node-fetch/fetch-blob
- npm: https://www.npmjs.com/package/fetch-blob
import { Blob } from 'https://esm.sh/fetch-blob'
Error message
After running deno run I get this:
/* esm.sh - error */
throw new Error("[esm.sh] " + "Could not resolve \"stream/web\"");
export default null;
Additional info
- esm.sh version: v53
- Deno version: 1.14
The line causing this issue: https://github.com/node-fetch/fetch-blob/blob/0e074572462f2df71c2507f187f164c61376257e/streams.cjs#L7
The module that needs to be added to polyfills: https://nodejs.org/api/webstreams.html#webstreams_web_streams_api
I can see now it is working
curl https://esm.sh/fetch-blob
shows
/* esm.sh - [email protected] */
export * from "https://cdn.esm.sh/v53/[email protected]/es2021/fetch-blob.js";
export { default } from "https://cdn.esm.sh/v53/[email protected]/es2021/fetch-blob.js";
Cheers
@Stradivario do named exports (i.e. Blob) work as well?
As far as i can see yes :)

@Stradivario try with deno run
new error now on v55:
➜ deno eval 'import { Blob } from \'https://esm.sh/fetch-blob\''
Check a generated module
error: Uncaught SyntaxError: Identifier '__process$' has already been declared
at <anonymous> (https://cdn.esm.sh/v55/[email protected]/deno/fetch-blob.js:2:328)
blocked by this on v57: https://github.com/denoland/deno_std/pull/1519 (not esm.sh bug)
main module is now importing fine on v58 but fetch-blob/from.js breaks because of worker_threads:
➜ deno eval "import {File, Blob, blobFrom, blobFromSync, fileFrom, fileFromSync} from 'https://esm.sh/fetch-blob/from.js'"
Download https://esm.sh/fetch-blob/from.js
Download https://cdn.esm.sh/error.js?type=unsupported-nodejs-builtin-module&name=worker_threads&importer=fetch-blob
Check a generated module
error: Import 'https://cdn.esm.sh/error.js?type=unsupported-nodejs-builtin-module&name=worker_threads&importer=fetch-blob' failed: 500 Internal Server Error
at https://cdn.esm.sh/v58/[email protected]/deno/from.js:2:1982
New error on v111:
/* esm.sh - error */
throw new Error("[esm.sh] " + "can not build 'file.js': can not build 'index.js': can not build 'streams.cjs': resovleESModule: open /tmp/esm-build-317b0017fa0b2b447e572409cd2667e1d5e63653-573b649a/node_modules/fetch-blob/streams.cjs.js: no such file or directory");
export default null;