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

Can't use @std/dotenv/load when using deno install and vendoring (no file matching entrypoint in vendor directory) #6108

Open
AFCMS opened this issue Oct 11, 2024 · 0 comments
Labels
bug Something isn't working needs triage

Comments

@AFCMS
Copy link

AFCMS commented Oct 11, 2024

Describe the bug

I wanted to make my project to use deno install and vendoring, but I encountered a strange problem, namely that when setting "vendor": true in the deno.json file and doing deno install, the dependencies are installed (both from NPM and jsr.io) but dotenv is missing the load entrypoint.

Steps to Reproduce

deno.json:

{
  "tasks": {},
  "imports": {
    "@db/sqlite": "jsr:@db/sqlite@^0.12.0",
    "@std/dotenv": "jsr:@std/dotenv@^0.225.2",
    "discord.js": "npm:discord.js@^14.16.3"
  }
}

main.ts:

import "@std/dotenv/load";
import * as sqlite from "@db/sqlite";

import discord from "discord.js";

Run:

deno install

IDE/compile/run error on the line with the dotenv import. If you don't pass the --cached-only flag to the run/compile command it will redownload automatically and succeed (and the error will be gone in IDE).

Files in the vendor directory:

image

The @std/dotenv package (on this specific version) seems to export the load.ts file, which is present in the repo. But it doesn't appear in the file tree.

I noticed something strange, when erasing the node_modules and vendor folders and running deno cache main.ts, the module is installed correctly including the load entrypoint (no more errors, everything works). But then why are the other entrypoints installed?

I don't really know if the error is in the package config or the deno install implementation but it's rather annoying since this command will allow painless layer caching in Docker.

Expected behavior

Same behavior when using deno install and deno cache main.ts if all dependencies are listed in deno.json.

Environment

  • OS: Fedora 40
  • deno version: 2.0.0
  • std version: 0.225.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

1 participant