Warning
preact-cli unfortunately no longer sees active development! It's stable so you can rely upon it for all of your existing apps, but for creating new ones, we recommend Vite via create-preact. It offers many of the same features but is a much faster, more modern experience. Thanks to all the contributors and users over the years!
Start building a Preact Progressive Web App in seconds 🔥
Contents
- Features
- Usage
- Official Templates
- CLI Options
- Pre-rendering
- Custom Configuration
- Using CSS preprocessors
- Using Environment Variables
- Route-Based Code Splitting
Features
- 100/100 Lighthouse score, right out of the box (proof)
- Fully automatic code splitting for routes (see Route-Based Code Splitting)
- Transparently code-split any component with an
async!prefix - Auto-generated Service Workers for offline caching powered by Workbox
- PRPL pattern support for efficient loading
- Zero-configuration pre-rendering / server-side rendering hydration
- Support for CSS Modules, LESS, Sass, Stylus; with Autoprefixer
- Monitor your bundle/chunk sizes with built-in tracking
- Automatic app mounting, debug helpers & Hot Module Replacement
- In just 4.5kb you get a productive environment:
- preact
- preact-router
- 1.5kb of conditionally-loaded polyfills for fetch & Promise
Requirements
Important: Node.js >= v14.14 is required.
Usage
"$ npm init preact-cli