finds.dev← search

// the find

jordwalke/one-click.js

★ 334 · JavaScript · MIT · updated Dec 2019

One Click, Offline, CommonJS Modules in the browser

A browser-side CommonJS module loader that requires no build step or web server — you literally double-click the HTML file. It's aimed at local development and prototyping, specifically for cases where spinning up a dev server is more friction than the task is worth.

The iframe-per-module isolation trick is genuinely clever — it gives you scoping without source transforms, which is the hard part of this problem. The node resolution algorithm (relative paths and node_modules) means existing CommonJS code mostly just works. Zero config: drop in a script tag with data-main and you're done. The README is honest about the tradeoffs, which is rare.

Abandoned since 2019 — ES modules with import maps solve this problem natively now in every modern browser, making this approach obsolete. The double-initialization to build the dependency graph is a real footgun: any module with side effects at load time will run twice, and the README buries this. The iframe-per-module design means instanceof checks break across module boundaries, which is a category of bug that's very hard to debug when you first hit it. Single 400-line file with no tests.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →