Davis
Davis3w ago

Transitive dependency "cannot find module"

Hello, I have some code like this:
import { PerspectiveEsbuildPlugin } from "npm:@finos/perspective-esbuild-plugin@3.2.0";
new PerspectiveEsbuildPlugin();
import { PerspectiveEsbuildPlugin } from "npm:@finos/perspective-esbuild-plugin@3.2.0";
new PerspectiveEsbuildPlugin();
Now, calling this constructor runs some code that eventually tries to const esbuild = require("esbuild");. However, "esbuild" is not in the deno environment. I tried to add an import map to my deno.json:
{
"imports": {
"esbuild": "https://deno.land/x/esbuild@v0.24.1/mod.js"
}
}
{
"imports": {
"esbuild": "https://deno.land/x/esbuild@v0.24.1/mod.js"
}
}
But Deno does not seem to do the import-mapping in a transitive fashion. Any tips on how I can get this to work? I really dont want to have to have a package.json and just having the one .ts file is really awesome (if I could get rid of the usage of deno.json here too it would be amazing)
1 Reply
Davis
DavisOP3w ago
I am not quite sure the cause of this. Maybe it is because esbuild is not referenced in the dependencies of @finos/perspective-esbuild-plugin? I am working around it for now by vendoring the package, and using a workspace directive in my deno.json I also had to update the code to use ESModules instead of the old require syntax

Did you find this page helpful?