Closed jimisaacs closed 5 months ago
Turns out, it has something to do with having 2 deps.ts
files that export the same imported react from a url (from esm.sh). I don't have a reduced case, but that's about as simple as a description as I can give right now. I deleted one of the deps.ts
files, and it works without error now.
Maybe related? https://github.com/denoland/deno/issues/13693
I can reproduce this error very simply:
$ deno --version
deno 1.22.3 (release, x86_64-unknown-linux-gnu)
v8 10.3.174.6
typescript 4.6.2
$ ls
repro.ts
$ cat repro.ts
import { MeiliSearch } from "https://esm.sh/meilisearch@0.25.1";
$ deno vendor --force ./repro.ts
Vendored 172 modules into vendor/ directory.
To use vendored modules, specify the `--import-map` flag when invoking deno subcommands:
deno run -A --import-map vendor/import_map.json ./repro.ts
$ deno bundle --import-map=vendor/import_map.json ./repro.ts
Check file:///home/tv/src/eagain.net/2022/deno-bundle-bug/repro.ts
error: Uncaught AssertionError: "data" is unexpectedly null for "https://esm.sh/v85/node.ns.d.ts".
at <anonymous> (deno:cli/tsc/99_main_compiler.js:71:13)
$ deno run --import-map=vendor/import_map.json ./repro.ts
Check file:///home/tv/src/eagain.net/2022/deno-bundle-issue14575/repro.ts
error: Uncaught AssertionError: "data" is unexpectedly null for "https://esm.sh/v85/node.ns.d.ts".
at <anonymous> (deno:cli/tsc/99_main_compiler.js:71:13)
Hey just curious about the difference between cache
& vendor
and if the following from op would be necessary/make sense?
deno vendor main.ts
deno cache main.ts --import-map vendor/import_map.json
From the docs I understand that they're kinda doing similar things though vendor more "explicit" with the goal of not just caching but making more deterministically offline available.
@dsherret Should X-Typescript-Types
be transformed to /// < reference types="..." />
in deno vendor
?
@nayeemrmn it should be handling x-typescript-types https://github.com/denoland/deno/blob/fd5a12d7e25dc53238e2bbcffe970e646c1035f3/cli/tools/vendor/build.rs#L505
@CanRau deno vendor
is to vendor dependencies to a local directory and use those instead of the remote dependencies. deno cache
is to cache the remote dependencies to the local deno cache in case they're not already cached.
@jimisaacs would you be able to provide a repo with a reproduction?
@jimisaacs would you be able to provide a repo with a reproduction?
There's a 1-liner repro in my earlier comment.
@tv42 I'm not able to reproduce with that in 1.23.1. Maybe upgrade deno and this is fixed?
With 1.23.1, I still see the deno bundle
crash, but not the deno run
crash:
$ podman run -it --rm docker.io/denoland/deno:alpine-1.23.1 /bin/sh
/ # echo 'import { MeiliSearch } from "https://esm.sh/meilisearch@0.25.1";' >repro.ts
/ # deno vendor --force ./repro.ts
...
Vendored 171 modules into vendor/ directory.
To use vendored modules, specify the `--import-map vendor/import_map.json` flag when invoking Deno subcommands or add an `"importMap": "<path_to_vendored_import_map>"` entry to a deno.json file.
/ # deno bundle --import-map=vendor/import_map.json ./repro.ts
Check file:///repro.ts
error: Uncaught AssertionError: "data" is unexpectedly null for "https://esm.sh/v86/node.ns.d.ts".
at <anonymous> (deno:cli/tsc/99_main_compiler.js:80:13)
/ # deno run --import-map=vendor/import_map.json ./repro.ts
/ #
@dsherret yea but I though vendor
is basically "caching" or is it safer to cache
after vendor
? 🤔
deno vendor
is deprecated - use vendor: true
in deno.json
instead.
The following works fine:
The following does not:
I get the feeling after looking through the vendor directory that some combination of
deno vendor
,deno cache
, and remote types using theX-Typescript-Types
header (i.e. https://esm.sh design), is broken.