esm.sh icon indicating copy to clipboard operation
esm.sh copied to clipboard

Failed to import - fetch-blob

Open v1rtl opened this issue 4 years ago • 8 comments

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

v1rtl avatar Sep 21 '21 13:09 v1rtl

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 avatar Oct 11 '21 08:10 Stradivario

@Stradivario do named exports (i.e. Blob) work as well?

v1rtl avatar Oct 11 '21 08:10 v1rtl

As far as i can see yes :)

Screenshot from 2021-10-11 12-54-39 Screenshot from 2021-10-11 12-54-23

Stradivario avatar Oct 11 '21 09:10 Stradivario

@Stradivario try with deno run

v1rtl avatar Oct 11 '21 10:10 v1rtl

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)

v1rtl avatar Oct 31 '21 07:10 v1rtl

blocked by this on v57: https://github.com/denoland/deno_std/pull/1519 (not esm.sh bug)

v1rtl avatar Nov 03 '21 21:11 v1rtl

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

v1rtl avatar Nov 22 '21 09:11 v1rtl

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;

v1rtl avatar Mar 09 '23 16:03 v1rtl