Dev & EngARTICLE

5 min read

Nudeps uses import maps to import npm packages in the browser without a bundler

The duo Lea Verou and Dmitry Sharabin launched Nudeps, a CLI that automatically generates and maintains import maps, allowing packages installed via npm to be imported by name, directly in HTML, without going through a bundler.

Nudeps uses import maps to import npm packages in the browser without a bundler
Image: Carina Ferreira
Article · Dev & Eng
Reading
5 min
Code
1

The duo Lea Verou and Dmitry Sharabin launched Nudeps, a CLI that automatically generates and maintains import maps, allowing packages installed via npm to be imported by name, directly in HTML, without going through a bundler.

Announced in issue #812 of the JavaScript Weekly newsletter, published on November 24, 2026, Nudeps is a CLI created by Lea Verou and Dmitry Sharabin to solve a problem every front-end developer has felt firsthand: importing an npm package by name, directly in the browser, without going through Webpack, Vite, or any other bundler.

The core promise is simple to state and historically hard to deliver: run npm install on any library and then write import something from 'package' in a <script type="module"> that the browser understands without any prior transformation. The mechanism behind this isn't new, but it's rarely used without pain: import maps.

The problem import maps solve

Native browser ES modules only know how to import by relative path or absolute URL. import React from 'react' fails right away in a plain <script type="module">, because the browser has nowhere to look up the string react. This is exactly the gap bundlers have historically filled: they rewrite every import by name into the physical path of the file, bundled or not.

The import map is HTML's own native answer to this problem. It's a <script type="importmap"> block that tells the browser, before any other script runs, where each "bare" specifier should point to:

html
<script type="importmap">
{
 "imports": {
 "lodash-es": "/node_modules/lodash-es/lodash.js",
 "zod": "/node_modules/zod/dist/esm/index.js"
 }
}
</script>
<script type="module">
 import { z } from "zod";
</script>

Support for import maps is already broad in modern browsers, but writing that map by hand is tedious and fragile: every transitive dependency also needs an entry, versions change, build paths vary between packages. That's exactly the work Nudeps promises to automate.

How Nudeps automates the import map

According to JavaScript Weekly's description, the proposed flow is lean: after installing dependencies normally with npm, you just run npx nudeps install and paste the generated import map script into the page's HTML. The tool's stated differentiator, according to JS Weekly, is keeping that map automatically up to date, sparing the manual work of rewriting the import map every time the project's dependencies change.

The terminal shows the npx nudeps install command generating the import map script
The terminal shows the npx nudeps install command generating the import map script. Reprodução: javascriptweekly.com.

Keeping that map automatically up to date helps address one of the most fragile points of any manual import map approach: transitive dependencies. If package A imports package B internally, the map also needs an entry for B, and for everything B imports, recursively. Automating this kind of update is the sort of repetitive work that usually pushes teams back toward a bundler just to avoid handling it by hand.

The launch of Nudeps continues a debate Lea Verou had already been raising publicly this year, in the essay "Web Dependencies are Broken. Can We Fix Them?", in which she questions why the JavaScript ecosystem came to accept as natural that managing front-end dependencies requires an entire build chain. Nudeps is the practical attempt to answer that question with a tool, not just an argument.

What changes in day-to-day workflow

For anyone maintaining small projects, prototypes, technical demos, or educational pages, the proposal has direct appeal. Today, even a three-file example often carries a vite.config.js, a package.json with build scripts, and a compilation step just to resolve import by name. If the import map covers the case, that example runs with any static server and nothing else.

The demos cited by JavaScript Weekly, available alongside the launch, serve exactly for that test: seeing the generated import map and opening the page without a build step in between. It's an invitation to experiment before deciding whether the model fits your project.

Trade-offs: where the bundler still wins

Import maps resolve importing by name, but they don't do what a bundler does afterward. It's worth looking clearly at what's left out:

  • Tree-shaking: without a bundler, the browser downloads the entire module the import map points to, not just what the code actually uses.
  • Code splitting: splitting the application into chunks loaded on demand is still the job of a build tool, not the import map.
  • CommonJS-only packages: libraries that don't ship an ESM build don't work directly via import map; they still require transformation.
  • Node built-ins and polyfills: code that depends on Node modules (fs, path, variables like process.env) doesn't run in the browser without a compatibility layer that a bundler normally already injects.
  • Number of requests: each module is a separate file fetched by the browser; HTTP/2 and HTTP/3 reduce the cost, but don't eliminate the difference for projects with dozens of dependencies.

In short: for a prototype, teaching material, proof of concept, or page with few native-ESM dependencies, giving up the bundler with a well-maintained import map is a real gain in simplicity. For a production application with a large dependency tree, bundle optimization still tips the scale in favor of the traditional build chain.

What remains open

The JavaScript Weekly material doesn't detail how Nudeps handles packages that mix formats, nor what the versioning policy is when two dependencies require different versions of the same lib, a classic deduplication problem that bundlers solve with hoisting and that import maps alone have no native mechanism to handle. There is also no load-time benchmark in the available sources comparing the final result with a traditional bundle.

These are natural questions for anyone adopting the tool in something beyond a demo: it's worth testing Nudeps on a small real project, with a handful of known ESM dependencies, and comparing the generated import map with what would be written by hand, before considering taking it to something bigger.

Translated from the Brazilian Portuguese original · Read the original