deno_std
deno_std copied to clipboard
Can't use `@std/dotenv/load` when using `deno install` and vendoring (no file matching entrypoint in vendor directory)
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:
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