Deno compatibility with local Node/NPM package
Hey everyone, I'm hoping to get some configuration advice for a tricky scenario involving Deno compatibility with a local package that targets the npm ecosystem.
I’m using a framework called SST, which generates a sidecar package inside an
.sst/
directory within my project. The .sst/
directory contains SST’s internal tooling, including its own package.json
and node_modules
.
My Deno code needs to import types from this generated directory. The problem seems rooted in .sst/
targetting the npm ecosystem, but Deno treats .sst/
like any other source code in the project, e.g., expects import foo from 'npm:bar'
instead of … from ‘bar’
, or import { add } from ‘./calc.ts’
instead of … from ‘./calc’
.
How do I make Deno treat the sidecar package generated by SST as an npm module?
Things I’ve tried:
- Configuring the patch
field in deno.json
. Per the docs, patch
is currently limited to JSR packages.
- I got type hints working by adding "unstable": ["sloppy-imports"]
to deno.json
. But, deno check
fails with errors like:
The error message and hint are noted, but as explained above, I don’t believe it’s applicable here because I need Deno to treat .sst/
as an npm module.
Note sure if this is relevant, but SST uses Bun as their runtime — not sure if there's an extra compatibility layer to worry about there or not.
For a minimal repro, you can run these commands:
Thanks for any help you can provide!1 Reply
The
patch
key has been renamed to links
a few versions ago and also supports npm packages
maybe you're on an older version of Deno