Snowpack

3.8.8 · abandoned · verified Tue Apr 21

Snowpack is a lightweight, ESM-powered frontend build tool designed for rapid development cycles by serving applications unbundled. It introduced "O(1) Build Tooling," where only changed files are recompiled, leading to near-instant Hot Module Replacement (HMR) and dev server startup times (under 50ms). Unlike traditional bundlers that rebuild entire applications on every save, Snowpack leverages native ES Modules in development, effectively offloading complex bundling tasks to a dedicated production build step using tools like Webpack or Rollup. The project's last stable release was 3.8.8. While Snowpack pioneered a novel approach to frontend development and gained significant traction, it has since been largely superseded. The project is no longer actively maintained, with its core ideas and principles having evolved into other actively developed tools, most notably Vite, which was created by Snowpack's original architect. This makes it an unsuitable choice for new projects requiring ongoing support.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates a basic Snowpack project with TypeScript, including package scripts, a configuration file, an HTML entry point, and a TypeScript source file, ready for development and production builds.

{
  "name": "my-snowpack-app",
  "version": "1.0.0",
  "scripts": {
    "start": "snowpack dev",
    "build": "snowpack build"
  },
  "devDependencies": {
    "snowpack": "^3.8.8",
    "typescript": "^4.0.0"
  }
}

// snowpack.config.mjs
export default {
  mount: {
    'public': '/',
    'src': '/_dist_',
  },
  plugins: ['@snowpack/plugin-typescript'],
  optimize: {
    bundle: true,
    minify: true,
    target: 'es2018',
  },
  devOptions: {
    open: 'none',
  },
  buildOptions: {
    out: 'build',
    clean: true,
  },
};

// public/index.html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Snowpack App</title>
</head>
<body>
  <div id="root"></div>
  <script type="module" src="/_dist_/index.js"></script>
</body>
</html>

// src/index.ts
const app = document.getElementById('root');
if (app) {
  app.innerHTML = `<h1>Hello from Snowpack & TypeScript!</h1>`;
}

console.log('Snowpack development server is running...');

view raw JSON →