<p dir="auto">I have code that works fine without import maps:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="nickolay@frontier:~/workspace/Bryntum/siesta-monorepo/siesta$ deno run -A --unstable --quiet tests/hook/hook.t.js
Launching test file: tests/hook/hook.t.js in Deno 1.9.2

 PASS  tests/hook/hook.t.js

Test files : 1 passed, 0 failed, 1 total
Time       : 33ms"><pre class="notranslate"><code class="notranslate">nickolay@frontier:~/workspace/Bryntum/siesta-monorepo/siesta$ deno run -A --unstable --quiet tests/hook/hook.t.js
Launching test file: tests/hook/hook.t.js in Deno 1.9.2

 PASS  tests/hook/hook.t.js

Test files : 1 passed, 0 failed, 1 total
Time       : 33ms
</code></pre></div>
<p dir="auto">Adding a dummy import map breaks it:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="nickolay@frontier:~/workspace/Bryntum/siesta-monorepo/siesta$ deno run -A --unstable --quiet --import-map import_map.json tests/hook/hook.t.js
error: Unmapped bare specifier &quot;path&quot;"><pre class="notranslate"><code class="notranslate">nickolay@frontier:~/workspace/Bryntum/siesta-monorepo/siesta$ deno run -A --unstable --quiet --import-map import_map.json tests/hook/hook.t.js
error: Unmapped bare specifier "path"
</code></pre></div>
<p dir="auto">How is this possible? It seems adding a source map changes the set of files being imported somehow. I do have the bare "path" but only in files that are used for Node. And again, the code works fine w/o import maps.</p>
<p dir="auto">Import map content for the full picture:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{
  &quot;imports&quot;:  {
    &quot;siesta/&quot;:  &quot;./&quot;
  }
}"><pre class="notranslate"><code class="notranslate">{
  "imports":  {
    "siesta/":  "./"
  }
}
</code></pre></div>
<p dir="auto">To reproduce:</p>
<ol dir="auto">
<li>clone the <code class="notranslate">git@github.com:bryntum/siesta.git</code>, specific revision is: 6e7e2576e0afcdd3f4f6e1966923ea46c29896eb</li>
<li><code class="notranslate">npm i</code> , <code class="notranslate">npx tsc</code></li>
<li><code class="notranslate">cd examples/deno</code></li>
<li>Launch w/o import maps: <code class="notranslate">deno run -A --unstable --quiet --no-check tests/index.ts</code><br>
Should see something like:</li>
</ol>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Launching test suite project: Awesome Deno project test suite in Deno 1.9.2

 FAIL  module/zoomer.t.js
├─✘ Using `zoomer` should work
│ └─✘ equal(received, expected)
│   
│     2 | import { zoomer } from &quot;../../src/module.js&quot;;
│     3 | it('Using `zoomer` should work', async (t) =&gt; {
│   ➤ 4 |     t.equal(zoomer('Myers Courtney', 35), { name: 'Courtney Myers', age: 35 });
│       |       ^
│     5 | });
│   
│   Received                   │ │ Expected                  
│                              │ │                           
│   {                          │ │ {                         
│     &quot;age&quot;: 35,               │ │   &quot;age&quot;: 35,              
│     &quot;name&quot;: &quot;Myers Courtney&quot; │ │   &quot;name&quot;: &quot;Courtney Myers&quot;
│   }                          │ │ }                         
│   "><pre class="notranslate"><code class="notranslate">Launching test suite project: Awesome Deno project test suite in Deno 1.9.2

 FAIL  module/zoomer.t.js
├─✘ Using `zoomer` should work
│ └─✘ equal(received, expected)
│   
│     2 | import { zoomer } from "../../src/module.js";
│     3 | it('Using `zoomer` should work', async (t) =&gt; {
│   ➤ 4 |     t.equal(zoomer('Myers Courtney', 35), { name: 'Courtney Myers', age: 35 });
│       |       ^
│     5 | });
│   
│   Received                   │ │ Expected                  
│                              │ │                           
│   {                          │ │ {                         
│     "age": 35,               │ │   "age": 35,              
│     "name": "Myers Courtney" │ │   "name": "Courtney Myers"
│   }                          │ │ }                         
│   
</code></pre></div>
<ol start="5" dir="auto">
<li>Launch with import maps: <code class="notranslate">deno run -A --unstable --quiet --no-check --import-map import_map.json tests/index.ts</code><br>
The output is:</li>
</ol>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="error: Unmapped bare specifier &quot;path&quot;"><pre class="notranslate"><code class="notranslate">error: Unmapped bare specifier "path"
</code></pre></div>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="if (never) {
  await import('whatever')
}"><pre class="notranslate"><span class="pl-k">if</span> <span class="pl-kos">(</span><span class="pl-s1">never</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-k">await</span> <span class="pl-k">import</span><span class="pl-kos">(</span><span class="pl-s">'whatever'</span><span class="pl-kos">)</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">I get the <code class="notranslate">unmapped bare specifier</code> error. But this should not cause any error or else it will be impossible to write code which supports several runtimes.</p>
<p dir="auto">Basically I want to check if it's running in Node.js and then to load a Node.js specific module ONLY in that case. When running in Deno or the browser then I don't need to do this, hence Deno should not complain about the code in the block which is never executed.</p>