Skip to content

Import maps mean small projects do not need a bundler

Bare module specifiers work natively in every current browser. For a site with a handful of dependencies, that removes the build step entirely.

Source: MDN

Import maps let you write import { html } from 'lit' in a plain <script type="module"> and have the browser resolve it, with no build step at all.

<script type="importmap">
  {
    "imports": {
      "lit": "https://cdn.jsdelivr.net/npm/lit@3/index.js"
    }
  }
</script>
<script type="module">
  import { html } from 'lit';
</script>

Why it matters: the main reason small projects reached for a bundler was rewriting bare specifiers into URLs. That reason is gone. For an internal tool, a prototype, or a marketing page with two dependencies, you can now delete the toolchain and keep the ergonomics.

You still want a bundler for anything with hundreds of modules — HTTP overhead and tree shaking are real. But the threshold where it becomes worth it moved a long way up, and most projects never reach it.

Share

Related reading

More from The Wire

All briefs