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

Unable to resolve jsr dependencies when vendor: true in deno.json #18

Open
bavoco opened this issue Oct 15, 2024 · 1 comment
Open

Unable to resolve jsr dependencies when vendor: true in deno.json #18

bavoco opened this issue Oct 15, 2024 · 1 comment

Comments

@bavoco
Copy link

bavoco commented Oct 15, 2024

To reproduce:

  • run deno clean
  • create a deno.json
  • run deno add jsr:@std/encoding
  • create an index.html which imports index.ts which imports @std/encoding/base64
  • add the plugin to your vite.config.ts
  • run deno run -A npm:vite
  • the following error will appear:
[vite] Internal server error: The system cannot find the file specified. (os error 2): readfile 'undefined' 
      at Object.readFile (ext:deno_fs/30_fs.js:747:24)
      at readFile (ext:deno_node/_fs/_fs_readFile.ts:29:14)
      at ext:deno_node/_fs/_fs_readFile.ts:44:5
      at new Promise (<anonymous>)
      at Module.readFilePromise (ext:deno_node/_fs/_fs_readFile.ts:43:10)

the root cause of this is that deno info --json @std/encoding/base64 does not have a local field in the "modules" section, which causes the id field in the object returned by resolver.js:resolveDeno() to be undefined.

Is this a bug in this plugin or should deno info --json always return a local field in the modules section?

@bavoco
Copy link
Author

bavoco commented Oct 15, 2024

BTW I'm fine with removing vendor: true from my deno.json if that makes this plugin work, but then I run into a different problem:

[vite] Internal server error: Failed to resolve import "./_validate_binary_like.ts" from "deno::TypeScript::@std/encoding/base64::C:/Users/my.username/AppData/Local/deno/remote/https/jsr.io/d0a47e8cc2cb0cb9991d5380e7bc290c496b680ff1b8a839bab0bc068c332477". Does the file exist?
  Plugin: vite:import-analysis
  File: deno::TypeScript::@std/encoding/base64::C:/Users/my.username/AppData/Local/deno/remote/https/jsr.io/d0a47e8cc2cb0cb9991d5380e7bc290c496b680ff1b8a839bab0bc068c332477:1:37
  1  |  import { validateBinaryLike } from "./_validate_binary_like.ts";
     |                                      ^
  2  |  const base64abc = [
  3  |    "A",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant