# preact-cli **Repository Path**: mirrors_developit/preact-cli ## Basic Information - **Project Name**: preact-cli - **Description**: 😺 Your next Preact PWA starts in 30 seconds. - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-02-24 - **Last Updated**: 2026-05-16 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # preact-cli [![NPM Downloads](https://img.shields.io/npm/dm/preact-cli.svg)](https://www.npmjs.com/package/preact-cli) [![NPM Version](https://img.shields.io/npm/v/preact-cli.svg)](https://www.npmjs.com/package/preact-cli) > [!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](https://vitejs.dev) via [`create-preact`](https://github.com/preactjs/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](#features) - [Usage](#usage) - [Official Templates](#official-templates) - [CLI Options](#cli-options) - [preact create](#preact-create) - [preact build](#preact-build) - [preact watch](#preact-watch) - [preact list](#preact-list) - [preact info](#preact-info) - [Pre-rendering](#pre-rendering) - [Custom Configuration](#custom-configuration) - [Plugins](#plugins) - [Browserslist](#browserslist) - [Babel](#babel) - [Webpack](#webpack) - [Prerender multiple routes](#prerender-multiple-routes) - [Template](#template) - [Using CSS preprocessors](#using-css-preprocessors) - [SASS](#sass) - [LESS](#less) - [Using Environment Variables](#using-environment-variables) - [Route-Based Code Splitting](#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](#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](https://nodejs.org/en/) >= v14.14 is required. ### Usage ```sh $ npm init preact-cli $ yarn create preact-cli ``` Example: ```sh $ npm init preact-cli default my-project ``` The above command pulls the template from [preactjs-templates/default] and generates the project at `./my-project/`. ### Official Templates The purpose of official preact project templates are to provide opinionated development tooling setups so that users can get started with actual app code as fast as possible. However, these templates are un-opinionated in terms of how you structure your app code and what libraries you use in addition to preact.js. All official project templates are repos in the [preactjs-templates organization]. When a new template is added to the organization, you will be able to run `npm init preact-cli ` to use that template. Current available templates include: - [default] - Default template with all features - [simple] - The simplest possible preact setup in a single file - [netlify] - Netlify CMS template using preact - [typescript] - Default template implemented in TypeScript - [widget] - Template for a widget to be embedded in another website - [widget-typescript] - Widget template implemented in TypeScript > 💁 Tip: Any Github repo with a `'template'` folder can be used as a custom template:
`npm init preact-cli / ` ### CLI Options #### preact list Lists all the official preactjs-cli repositories ```sh $ [npm init / yarn create] preact-cli list ``` #### preact create Create a project to quick start development. ``` $ [npm init / yarn create] preact-cli --name The application name. --cwd A directory to use instead of $PWD. --force Force option to create the directory for the new app [boolean] [default: false] --git Initialize version control using git. [boolean] [default: false] --install Installs dependencies. [boolean] [default: true] ``` #### preact build Create a production build You can disable `default: true` flags by prefixing them with `--no-