Snowpack, from the team at Pika, is best understood as a bundler alternative. It processes the packages you pull from npm so that they are ES module-compatible and can be consumed through native imports.

To see why that matters, consider a line of code like:

import React from "react";

This is not valid JavaScript. It resembles a native import, but a genuine native import begins with a filepath character such as ./ and ends in .js. The bare package name above is instead an understanding baked into bundlers: go look in node_modules for this thing, then resolve it. Plenty of npm content is not ready for ES modules — it is in another module format, CommonJS for instance, and assumes a bundler is in the picture. That assumption served the ecosystem for a while, but it has become a friction point for front-end developers.

Prior workarounds remain partial. UNPKG lets you append ?module to its URLs to serve an ES module-friendly version of a package, but the feature has stayed experimental for a long time, presumably because deciding which packages are ready for ES modules and processing the rest on the fly is a hard problem. The Pika CDN does not cover packages that were never written for ES module usage either: React is not written to be used with ES modules directly, so it cannot be imported that way, though it still works via a <script> tag.

Snowpack addresses this by running over the packages you install locally and preparing them for ES module usage. Once it has run, an import that was previously impossible becomes valid ES module code:

import React from '/web_modules/react.js';

If Babel is already part of your setup, you don't even have to change that original line.

The workflow Snowpack's creators describe comes down to a few steps:

  1. Instead of bundling on every change, run Snowpack once right after npm install.
  2. Snowpack re-installs your dependencies as single JS files into a new web_modules/ directory.
  3. Write code, import those dependencies via an ESM import, and run it all in the browser.
  4. Skip the bundle step and see your changes reflected in the browser immediately after hitting save.
  5. Keep using your favorite web frameworks and build tools; Babel and TypeScript are supported.

The payoff is something like native code splitting for free, with the open question of whether ES modules will prove as fast as bundling. Native ES modules look like the future, but this is early days and a setup worth approaching with caution on large production projects.