TL;DR: TypeScript + modern CSS, compiled straight to browser-ready ES modules, no node_modules, no package.json, no bundler chain.
I just created and released Snapfire Compiler (snapfirec), a tiny Rust binary that turns your .ts + .css into browser-friendly .js and optimized .css, fast and predictable.
The problem (short)
TypeScript is fantastic, but the ecosystem isn’t. What should be a tiny, portable vanilla-JS library too often becomes a 200 MB node_modules mess, a dozen build plugins, and a bundler config longer than your code. Browsers now understand ES modules and Web Components, but most tooling still assumes Node as the runtime — and that drags your project into dependency hell.
The idea
Write TypeScript and modern CSS locally, compile to browser-native output, and ship a dist/ that any HTML page or CDN can consume. No Node.js required to install the tool just a single Rust binary.
Meet Snapfire
Snapfire Compiler (snapfirec) is an opinionated compiler written in Rust (powered by swc and lightningcss) that replaces the usual dev-chain for producing browser-ready libraries. It’s designed for authors who want small, portable, dependency-light outputs for Web Components, HTMX extensions, or tiny UI libs.
Who's this for?
If you build small, framework-agnostic libraries, your distribution should be equally lightweight and portable. Snapfire keeps your runtime simple and your build reproducible — no extra runtime assumptions and far fewer supply-chain surprises.
Key features (quick)
- Browser-native output: imports like import {x} from './state' are rewritten to ./state.js
- Zero NPM: no node_modules, no published dev-tool dependencies
- CSS handled natively: nesting flattening, prefixes, minify.
- Small surface area: single binary, fast startup, Rust reliability
More details:
- Browser-Native Output: TypeScript allows you to import files without extensions (e.g., import { state } from './state'). Browsers hate this; they need the .js. Snapfire automatically analyzes your AST and rewrites these imports to be browser-compliant (./state.js) during compilation.
- Smart CSS via .browserslistrc: It compiles your CSS using LightningCSS. You get minification, vendor prefixing, and CSS Nesting flattening out of the box. Best of all, it respects your .browserslistrc file. You define the targets (e.g., last 2 versions), and Snapfire ensures your modern CSS works everywhere you need it to.
- Standard Configs Only: You don't need a package.json or a proprietary config file. Snapfire just looks for your standard tsconfig.json to know where your source files are, and your .browserslistrc for CSS targets. That's it.
- Production Optimizations: It includes flags to strip console.log and console.debug statements from your output automatically, ensuring your production builds are clean without manual cleanup.
Quick start
Install and run:
cargo install snapfire_compiler
# compile project at current directorysnapfirec --root .
src/ → dist/ (browser-ready). Drop dist/ into any static host or CDN.
Small example — import rewrite
Before (TypeScript source)
// src/index.tsimport { state } from './state'console.log(state)
After (what the browser sees)
// dist/index.jsimport { state } from './state.js'console.log(state)
Snapfire analyzes the AST and rewrites module specifiers so the output works in browsers without a bundler.
Want to try it?
If you’ve ever wanted to delete node_modules and still ship TypeScript-powered code that runs in the browser, Snapfire is for you. Try it on a toy project, then tell me about the edge cases you hit; I’m excited to make it better
