adam bien's blog

Buildless Web Components BCE/ECB Quickstarter 📎

The bce.design quickstarter lost its entire build system: Node.js, npm, rollup, lockfiles. 777 lines deleted.

The toolchain existed for one reason: Redux Toolkit. It ships with transitive dependencies (immer, redux, reselect), so a bundler had to flatten it into a browser-loadable module.

Then Redux Toolkit got replaced with reduction.js, a 70-line, standards-based implementation of the used API, relying on structuredClone instead of Immer.

The only dependency left: lit-html. And lit-html is a single, self-contained, dependency-free ES module. The bundler's output was byte-for-byte its input. The whole machinery reduced to:

curl -fsSL https://registry.npmjs.org/lit-html/-/lit-html-3.3.3.tgz \
    | tar -xzO package/lit-html.js > app/src/libs/lit-html.js

Straight from the npm registry: no CDN, no middleman, the exact bytes npm install would deliver.

The vendored module is mapped with a standard import map in index.html:

<script type="importmap">
{
  "imports": {
    "lit-html": "/libs/lit-html.js",
    "@reduxjs/toolkit": "/reduction.js"
  }
}
</script>

Routing is implemented with the Navigation API and URLPattern, so there is no router dependency either.

Remove a dependency, and the tooling it dragged in disappears with it. Web standards are the best dependency: nothing to install, nothing to build, nothing to migrate.