kebK
Denoβ€’3y agoβ€’
24 replies
keb

Using esbuild with import maps

Hello πŸ‘‹ I'm attempting to migrate one of my front-end projects to using Deno for tooling instead of Node. The setup is very simple; my frontend code lives in src/ and should be bundled by esbuild and output to dist/. I'd like to use import maps to keep my front-end code easy to read, so for example, in my frontend code I have an import that looks like import { m } from 'umai'; and then in my
deno.json
file I have:
  "imports": {
    "std/": "https://deno.land/std@0.201.0/",
    "umai": "https://deno.land/x/umai@0.2.4/index.js",
    "esbuild": "https://deno.land/x/esbuild@v0.19.3/mod.js"
  }

However, when I try running my esbuild build script, I get this error:
✘ [ERROR] Could not resolve "umai"

    src/Apps.js:1:26:
      1 β”‚ import { m } from 'umai';
        β•΅                           ~~~~~~

Which seems to imply that while Deno can resolve import maps, esbuild cannot. Has anyone figure out a way around this?
Was this page helpful?