<p dir="auto"><strong>Describe the bug</strong></p>
<p dir="auto">Unable to bundle TS code that uses the DOM.</p>
<p dir="auto"><strong>To Reproduce</strong></p>
<ol dir="auto">
<li>Create a <code class="notranslate">test.ts</code> file with contents:</li>
</ol>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="document.getElementById(&quot;comments-container&quot;);"><pre class="notranslate"><span class="pl-smi">document</span><span class="pl-kos">.</span><span class="pl-en">getElementById</span><span class="pl-kos">(</span><span class="pl-s">"comments-container"</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<ol start="2" dir="auto">
<li>Create <code class="notranslate">tsconfig.json</code> with contents:</li>
</ol>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
  &quot;compilerOptions&quot;: {
    &quot;target&quot;: &quot;ES2016&quot;,
    &quot;module&quot;: &quot;commonjs&quot;,
    &quot;lib&quot;: [&quot;DOM&quot;, &quot;ESNext&quot;],
    &quot;esModuleInterop&quot;: true,
    &quot;skipLibCheck&quot;: true,
    &quot;forceConsistentCasingInFileNames&quot;: true
  }
}"><pre class="notranslate">{
  <span class="pl-ent">"compilerOptions"</span>: {
    <span class="pl-ent">"target"</span>: <span class="pl-s"><span class="pl-pds">"</span>ES2016<span class="pl-pds">"</span></span>,
    <span class="pl-ent">"module"</span>: <span class="pl-s"><span class="pl-pds">"</span>commonjs<span class="pl-pds">"</span></span>,
    <span class="pl-ent">"lib"</span>: [<span class="pl-s"><span class="pl-pds">"</span>DOM<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>ESNext<span class="pl-pds">"</span></span>],
    <span class="pl-ent">"esModuleInterop"</span>: <span class="pl-c1">true</span>,
    <span class="pl-ent">"skipLibCheck"</span>: <span class="pl-c1">true</span>,
    <span class="pl-ent">"forceConsistentCasingInFileNames"</span>: <span class="pl-c1">true</span>
  }
}</pre></div>
<ol start="3" dir="auto">
<li>Run the <code class="notranslate">deno bundle</code> command:</li>
</ol>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="deno bundle --unstable -c tsconfig.json test.ts dist/test.js"><pre class="notranslate">deno bundle --unstable -c tsconfig.json test.ts dist/test.js</pre></div>
<p dir="auto">This will fail with the following error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Bundle file:///Users/renato/programming/projects/static-website-reddit-comments/test.ts
Check file:///Users/renato/programming/projects/static-website-reddit-comments/test.ts
error: AssertionError: &quot;data&quot; is unexpectedly null for &quot;asset:///lib.dom.d.ts&quot;.
    at assert (deno:cli/tsc/99_main_compiler.js:53:13)
    at Object.getSourceFile (deno:cli/tsc/99_main_compiler.js:377:9)
    at findSourceFile (deno:cli/tsc/00_typescript.js:104355:29)
    at deno:cli/tsc/00_typescript.js:104232:85
    at getSourceFileFromReferenceWorker (deno:cli/tsc/00_typescript.js:104199:34)
    at processSourceFile (deno:cli/tsc/00_typescript.js:104232:13)
    at processRootFile (deno:cli/tsc/00_typescript.js:104055:13)
    at deno:cli/tsc/00_typescript.js:103004:25
    at Object.forEach (deno:cli/tsc/00_typescript.js:382:30)
    at Object.createProgram (deno:cli/tsc/00_typescript.js:103003:24)"><pre class="notranslate"><code class="notranslate">Bundle file:///Users/renato/programming/projects/static-website-reddit-comments/test.ts
Check file:///Users/renato/programming/projects/static-website-reddit-comments/test.ts
error: AssertionError: "data" is unexpectedly null for "asset:///lib.dom.d.ts".
    at assert (deno:cli/tsc/99_main_compiler.js:53:13)
    at Object.getSourceFile (deno:cli/tsc/99_main_compiler.js:377:9)
    at findSourceFile (deno:cli/tsc/00_typescript.js:104355:29)
    at deno:cli/tsc/00_typescript.js:104232:85
    at getSourceFileFromReferenceWorker (deno:cli/tsc/00_typescript.js:104199:34)
    at processSourceFile (deno:cli/tsc/00_typescript.js:104232:13)
    at processRootFile (deno:cli/tsc/00_typescript.js:104055:13)
    at deno:cli/tsc/00_typescript.js:103004:25
    at Object.forEach (deno:cli/tsc/00_typescript.js:382:30)
    at Object.createProgram (deno:cli/tsc/00_typescript.js:103003:24)
</code></pre></div>
<p dir="auto"><strong>Expected behavior</strong></p>
<p dir="auto">The <code class="notranslate">Deno bundle</code> command should succeed.</p>
<p dir="auto">It worked before I upgraded to 1.5.0.</p>
<p dir="auto"><strong>Versions</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="▶ deno --version
deno 1.5.0
v8 8.7.220.3
typescript 4.0.3"><pre class="notranslate"><code class="notranslate">▶ deno --version
deno 1.5.0
v8 8.7.220.3
typescript 4.0.3
</code></pre></div>
<p dir="auto">getting this error</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="AssertionError: &quot;data&quot; is unexpectedly null for &quot;asset:///lib.dom.d.ts&quot;.
    at assert (deno:cli/tsc/99_main_compiler.js:53:13)
    at Object.getSourceFile (deno:cli/tsc/99_main_compiler.js:377:9)
    at findSourceFile (deno:cli/tsc/00_typescript.js:104355:29)
    at deno:cli/tsc/00_typescript.js:104232:85
    at getSourceFileFromReferenceWorker (deno:cli/tsc/00_typescript.js:104199:34)
    at processSourceFile (deno:cli/tsc/00_typescript.js:104232:13)
    at processRootFile (deno:cli/tsc/00_typescript.js:104055:13)
    at deno:cli/tsc/00_typescript.js:104630:21
    at Object.forEach (deno:cli/tsc/00_typescript.js:382:30)
    at processLibReferenceDirectives (deno:cli/tsc/00_typescript.js:104625:16)"><pre class="notranslate"><code class="notranslate">AssertionError: "data" is unexpectedly null for "asset:///lib.dom.d.ts".
    at assert (deno:cli/tsc/99_main_compiler.js:53:13)
    at Object.getSourceFile (deno:cli/tsc/99_main_compiler.js:377:9)
    at findSourceFile (deno:cli/tsc/00_typescript.js:104355:29)
    at deno:cli/tsc/00_typescript.js:104232:85
    at getSourceFileFromReferenceWorker (deno:cli/tsc/00_typescript.js:104199:34)
    at processSourceFile (deno:cli/tsc/00_typescript.js:104232:13)
    at processRootFile (deno:cli/tsc/00_typescript.js:104055:13)
    at deno:cli/tsc/00_typescript.js:104630:21
    at Object.forEach (deno:cli/tsc/00_typescript.js:382:30)
    at processLibReferenceDirectives (deno:cli/tsc/00_typescript.js:104625:16)
</code></pre></div>
<p dir="auto">to reproduce</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="create A.ts with writeTextFileSync
insert tripple slash reference with lib=dom
import dynamically A.ts"><pre class="notranslate"><code class="notranslate">create A.ts with writeTextFileSync
insert tripple slash reference with lib=dom
import dynamically A.ts
</code></pre></div>