Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to import - fetch-blob #163

Closed
talentlessguy opened this issue Sep 21, 2021 · 9 comments · Fixed by denoland/std#1297
Closed

Failed to import - fetch-blob #163

talentlessguy opened this issue Sep 21, 2021 · 9 comments · Fixed by denoland/std#1297
Labels
bug Something isn't working

Comments

@talentlessguy
Copy link
Contributor

talentlessguy commented Sep 21, 2021

Failing module

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

@Stradivario
Copy link

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

@talentlessguy
Copy link
Contributor Author

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

@Stradivario
Copy link

As far as i can see yes :)

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

@talentlessguy
Copy link
Contributor Author

@Stradivario try with deno run

@talentlessguy
Copy link
Contributor Author

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)

@talentlessguy
Copy link
Contributor Author

blocked by this on v57: denoland/std#1519 (not esm.sh bug)

@talentlessguy
Copy link
Contributor Author

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

@talentlessguy
Copy link
Contributor Author

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;

@talentlessguy
Copy link
Contributor Author

works on v135

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants