esm.sh
esm.sh copied to clipboard
Importing uuid leads to dependencies on Deno namespace
Failing module
- GitHub: https://github.com/uuidjs/uuid
- npm: https://www.npmjs.com/package/uuid
import { v4 as uuid } from 'https://esm.sh/uuid'
Error message
After running deno bunlde I get this:
error: TS7053 [ERROR]: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'ReadableStream<R>'.
Property '[SymbolConstructor.asyncIterator]' does not exist on type 'ReadableStream<R>'.
return res.readable[Symbol.asyncIterator]();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
at https://deno.land/[email protected]/async/pool.ts:67:10
TS2339 [ERROR]: Property 'cause' does not exist on type 'PartialReadError'.
e.cause = err.cause;
~~~~~
at https://deno.land/[email protected]/io/buffer.ts:432:13
TS2339 [ERROR]: Property 'cause' does not exist on type 'Error'.
e.cause = err.cause;
~~~~~
at https://deno.land/[email protected]/io/buffer.ts:432:25
TS2304 [ERROR]: Cannot find name 'Deno'.
if (err instanceof Deno.errors.BadResource) {
~~~~
at https://deno.land/[email protected]/io/buffer.ts:499:26
TS2339 [ERROR]: Property 'cause' does not exist on type 'PartialReadError'.
e.cause = err.cause;
~~~~~
at https://deno.land/[email protected]/io/buffer.ts:618:13
TS2339 [ERROR]: Property 'cause' does not exist on type 'Error'.
e.cause = err.cause;
~~~~~
at https://deno.land/[email protected]/io/buffer.ts:618:25
TS2339 [ERROR]: Property 'cause' does not exist on type 'PartialReadError'.
e.cause = err.cause;
~~~~~
at https://deno.land/[email protected]/io/buffer.ts:663:13
TS2339 [ERROR]: Property 'cause' does not exist on type 'Error'.
e.cause = err.cause;
~~~~~
at https://deno.land/[email protected]/io/buffer.ts:663:25
TS2503 [ERROR]: Cannot find namespace 'Deno'.
function isCloser(value: unknown): value is Deno.Closer {
~~~~
at https://deno.land/[email protected]/streams/conversion.ts:8:45
TS2503 [ERROR]: Cannot find namespace 'Deno'.
): Deno.Reader {
~~~~
at https://deno.land/[email protected]/streams/conversion.ts:37:4
TS2503 [ERROR]: Cannot find namespace 'Deno'.
): Deno.Writer {
~~~~
at https://deno.land/[email protected]/streams/conversion.ts:71:4
TS2503 [ERROR]: Cannot find namespace 'Deno'.
): Deno.Reader {
~~~~
at https://deno.land/[email protected]/streams/conversion.ts:84:4
TS2503 [ERROR]: Cannot find namespace 'Deno'.
writer: Deno.Writer,
~~~~
at https://deno.land/[email protected]/streams/conversion.ts:114:11
TS2503 [ERROR]: Cannot find namespace 'Deno'.
reader: Deno.Reader | (Deno.Reader & Deno.Closer),
~~~~
at https://deno.land/[email protected]/streams/conversion.ts:236:11
TS2503 [ERROR]: Cannot find namespace 'Deno'.
reader: Deno.Reader | (Deno.Reader & Deno.Closer),
~~~~
at https://deno.land/[email protected]/streams/conversion.ts:236:26
TS2503 [ERROR]: Cannot find namespace 'Deno'.
reader: Deno.Reader | (Deno.Reader & Deno.Closer),
~~~~
at https://deno.land/[email protected]/streams/conversion.ts:236:40
TS2503 [ERROR]: Cannot find namespace 'Deno'.
export async function readAll(r: Deno.Reader): Promise<Uint8Array> {
~~~~
at https://deno.land/[email protected]/streams/conversion.ts:295:34
TS2503 [ERROR]: Cannot find namespace 'Deno'.
export function readAllSync(r: Deno.ReaderSync): Uint8Array {
~~~~
at https://deno.land/[email protected]/streams/conversion.ts:323:32
TS2503 [ERROR]: Cannot find namespace 'Deno'.
export async function writeAll(w: Deno.Writer, arr: Uint8Array) {
~~~~
at https://deno.land/[email protected]/streams/conversion.ts:352:35
TS2503 [ERROR]: Cannot find namespace 'Deno'.
export function writeAllSync(w: Deno.WriterSync, arr: Uint8Array): void {
~~~~
at https://deno.land/[email protected]/streams/conversion.ts:383:33
TS2503 [ERROR]: Cannot find namespace 'Deno'.
r: Deno.Reader,
~~~~
at https://deno.land/[email protected]/streams/conversion.ts:424:6
TS2503 [ERROR]: Cannot find namespace 'Deno'.
r: Deno.ReaderSync,
~~~~
at https://deno.land/[email protected]/streams/conversion.ts:475:6
TS2503 [ERROR]: Cannot find namespace 'Deno'.
src: Deno.Reader,
~~~~
at https://deno.land/[email protected]/streams/conversion.ts:510:8
TS2503 [ERROR]: Cannot find namespace 'Deno'.
dst: Deno.Writer,
~~~~
at https://deno.land/[email protected]/streams/conversion.ts:511:8
TS2304 [ERROR]: Cannot find name 'Deno'.
const p = Deno.run({
~~~~
at https://deno.land/[email protected]/node/_utils.ts:229:13
TS2304 [ERROR]: Cannot find name 'Deno'.
Deno.execPath(),
~~~~
at https://deno.land/[email protected]/node/_utils.ts:231:7
TS2304 [ERROR]: Cannot find name 'Deno'.
const core = ((Deno as any).core as any);
~~~~
at https://deno.land/[email protected]/node/_next_tick.ts:10:16
TS2304 [ERROR]: Cannot find name 'Deno'.
return Deno.inspect(object, {
~~~~
at https://deno.land/[email protected]/node/util.ts:40:10
TS2304 [ERROR]: Cannot find name 'Deno'.
} else return Deno.inspect(value, { depth: 1 });
~~~~
at https://deno.land/[email protected]/node/util.ts:176:19
TS2304 [ERROR]: Cannot find name 'Deno'.
return Deno.inspect(value, { showHidden: true, showProxy: true });
~~~~
at https://deno.land/[email protected]/node/util.ts:205:12
TS2304 [ERROR]: Cannot find name 'Deno'.
return Deno.inspect(value);
~~~~
at https://deno.land/[email protected]/node/util.ts:208:12
TS2304 [ERROR]: Cannot find name 'Deno'.
} else result += Deno.inspect(args[i], { colors: true });
~~~~
at https://deno.land/[email protected]/node/util.ts:250:22
TS2304 [ERROR]: Cannot find name 'Deno'.
err += ` '${Deno.inspect(this.args[i])}'`;
~~~~
at https://deno.land/[email protected]/fmt/printf.ts:95:21
TS2304 [ERROR]: Cannot find name 'Deno'.
return this.pad(Deno.inspect(val, options));
~~~~
at https://deno.land/[email protected]/fmt/printf.ts:720:23
TS2304 [ERROR]: Cannot find name 'Deno'.
Deno.stdout.writeSync(new TextEncoder().encode(s));
~~~~
at https://deno.land/[email protected]/fmt/printf.ts:756:3
TS2304 [ERROR]: Cannot find name 'Deno'.
console.error(sprintf("%s %s: %s\n", set, String(Deno.pid), msg));
~~~~
at https://deno.land/[email protected]/node/_util/_debuglog.ts:48:58
TS2304 [ERROR]: Cannot find name 'Deno'.
if (Deno.permissions) {
~~~~
at https://deno.land/[email protected]/node/_util/_debuglog.ts:106:5
TS2304 [ERROR]: Cannot find name 'Deno'.
state = (await Deno.permissions.query({
~~~~
at https://deno.land/[email protected]/node/_util/_debuglog.ts:107:18
TS2304 [ERROR]: Cannot find name 'Deno'.
initializeDebugEnv(Deno.env.get("NODE_DEBUG") ?? "");
~~~~
at https://deno.land/[email protected]/node/_util/_debuglog.ts:114:22
TS2339 [ERROR]: Property 'randomUUID' does not exist on type 'Crypto'.
const randomUUID = () => crypto.randomUUID();
~~~~~~~~~~
at https://deno.land/[email protected]/node/crypto.ts:157:33
Found 40 errors.
i bundle for web browser, so Deno namespace is not available, yet somehow references to std library...
Additional info
- esm.sh version: v58 (running locally)
- Deno version: 1.17.0
Use https://esm.sh/uuid?target=esnext to avoid the User-Agent string auto-detecting that you're targeting the Deno environment. I saw in another issue there were some bugs with the target parameter in v63, so you might need to try different pinned versions / targets.
or you can set the 'target' upper than es2018 in the deno.json to support the AsyncIterator feature.
but i just tried in deno 1.18.2, seems it works without deno.json config