danthemanD
Denoβ€’5mo agoβ€’
5 replies
dantheman

Configure a deno.json to disregard package.json?

I have a few projects where a small Deno backend serves APIs for a classic Vite frontend (react, eslint, typescript, etc).
So I have my backend dependencies in
deno.json
while all of the numerous toolchain deps are in
package.json
.

This has been a pretty clean setup, however Deno has the annoying habit of also reading
package.json
and adding stuff from it to deno.lock. Recently I've also begun using JSR packages in
package.json
for my frontend app, which makes Deno crash out.

I've started setting DENO_NO_PACKAGE_JSON=1 in my CI and terminals to address this. But I can't see how to set it more properly in
deno.json
so it always applies. And now I'm seeing that the deno LSP is starting to complain too! I don't know how to set DENO_NO_PACKAGE_JSON=1 on the LSP. So when I try importing an npm module in Deno, it complaints that the
package.json
is using a JSR module.

Any advice on using
package.json
and
deno.json
independently in the same repo?
image.png
Was this page helpful?