← Home ← Codex ← DEBT
Browse by Category
+ added · updated 7d
← Back to glossary

Import Maps

JavaScript ES2020 Intermediate
debt(d7/e3/b5/t7)
d7 Detectability Operational debt — how invisible misuse is to your safety net

Closest to 'only careful code review or runtime testing' (d7). The term's detection_hints indicate no automated tooling (`automated: no`), and the common mistake about declaration order (import map must come before module scripts) won't be caught by linters or compilers—only discovered through runtime testing or careful review.

e3 Effort Remediation debt — work required to fix once spotted

Closest to 'simple parameterised fix' (e3). The quick_fix is straightforward: reorder script tags, swap CDN URLs to ESM-compatible sources, and update the import map declaration. These are contained changes within the HTML/module setup, not cross-cutting refactors.

b5 Burden Structural debt — long-term weight of choosing wrong

Closest to 'persistent productivity tax' (b5). Import maps affect how all module resolution works in the web context (`applies_to: web`). Teams must decide on CDN sources, maintain the import map as dependencies change, and coordinate across projects if shared. It's not load-bearing enough for b7 (not every change is shaped by it), but it does slow down work streams that touch module dependencies.

t7 Trap Cognitive debt — how counter-intuitive correct behaviour is

Closest to 'serious trap' (t7). The misconception explicitly warns that import maps replace bundlers—a significant wrong mental model—and common mistakes reveal contradictions: developers expect CommonJS CDN URLs to work, or expect Node.js support (where import maps don't apply). These represent serious gotchas that contradict how similar module concepts work in other environments.

About DEBT scoring →

TL;DR

Import maps let browsers resolve bare module specifiers (import 'lodash') without a bundler — mapping module names to URLs in a JSON script tag.

Explanation

Import maps (<script type='importmap'>) define a JSON mapping of bare specifiers to URLs. Without a bundler: import 'lodash' resolves to 'https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm'. This enables CDN-based ES module development without npm/bundler. Also supports scopes for version-specific imports in nested dependencies. Import maps must be declared before any module scripts. Fully supported in Chrome 89+, Firefox 108+, Safari 16.4+. Use esm.sh or skypack for CDN-hosted ES modules.

Common Misconception

Import maps replace bundlers entirely for production — they're best for development or small projects. Production still benefits from bundling for performance.

Why It Matters

Import maps enable framework-free ES module development in browsers, removing the bundler requirement for simple apps and speeding up development iterations.

Common Mistakes

  • Declaring import map after module scripts — must come first.
  • Using CommonJS CDN URLs — import maps need ES module (ESM) URLs.
  • Expecting import maps to work in Node.js — they're a browser feature (Node has its own resolution).

Code Examples

✗ Vulnerable
<!-- Before import maps: requires bundler for bare specifiers -->
<script>
import lodash from 'lodash'; // Fails in browser
</script>
✓ Fixed
<script type="importmap">
{
  "imports": {
    "lodash": "https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm",
    "react": "https://esm.sh/react@18",
    "react-dom/client": "https://esm.sh/react-dom@18/client"
  }
}
</script>
<script type="module">
  import _ from 'lodash'; // Works!
</script>

Added 23 Mar 2026
Views 57
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
0 pings T 0 pings W 1 ping T 0 pings F 0 pings S 0 pings S 1 ping M 0 pings T 0 pings W 1 ping T 1 ping F 1 ping S 0 pings S 2 pings M 1 ping T 2 pings W 1 ping T 2 pings F 1 ping S 0 pings S 1 ping M 0 pings T 0 pings W 0 pings T 0 pings F 0 pings S 0 pings S 0 pings M 2 pings T 0 pings W
No pings yet today
PetalBot 2
Amazonbot 10 Scrapy 7 Google 5 Perplexity 5 Unknown AI 4 SEMrush 4 Ahrefs 3 Majestic 2 Claude 2 PetalBot 2 ChatGPT 1 Meta AI 1 Bing 1
crawler 43 crawler_json 2 pre-tracking 2
DEV INTEL Tools & Severity
🔵 Info ⚙ Fix effort: Low
⚡ Quick Fix
Add <script type='importmap'> before module scripts. Use esm.sh or skypack for CDN ESM URLs. Declare all bare specifiers used in your modules.
📦 Applies To
javascript ES2020 web
🔗 Prerequisites
🔍 Detection Hints
type="importmap"
Auto-detectable: ✗ No
🤖 AI Agent
Confidence: Low False Positives: High ✗ Manual fix Fix: Medium Context: File


✓ schema.org compliant