#Transitive dependency "cannot find module"

1 messages · Page 1 of 1 (latest)

barren wraith
#

Hello, I have some code like this:

import { PerspectiveEsbuildPlugin } from "npm:@finos/[email protected]";
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/[email protected]/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)

barren wraith
#

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