2.3 KiB


Npm package version Npm package version Npm package types

A simple tool to pre-render any webapp.


This project is licensed under AGPL-3.0-or-later. See the LICENSE file for more informations.


To use the pre-renderer, the most basic version is to just call it's binary: webapp-prerender.

The cli supports a some options:

$ webapp-prerender --help
Usage: webapp-prerender <options>

  -h, --help                Prints this help
  -s, --src                 The source directory where the app to prerender is located
                                Default: $(pwd)/build
  -d, --dst                 The destination directory where to output the prerendered html
                                Default: $(pwd)/out
  --clean                   Clears the destination directory before writing.
  --minify, --no-minify     Minifies/Not-minifies the html
  --browser-exe             Sets the browser executable for puppeteer
  --verbose                 Enables verbose printing

Advanced configuration

For more advanced configuration, including adding plugins, you'll need to create a configuration file.

The webapp-prerender loads following files in the order they're listed here:

  • webapp-prerender.config.ts
  • webapp-prerender.config.mts
  • webapp-prerender.config.cts
  • webapp-prerender.config.js
  • webapp-prerender.config.mjs
  • webapp-prerender.config.cjs
  • webapp-prerender.config.json When one is found, it is loaded and the rest is skipped.

All cli options are applied after the config was loaded, which means they overwrite the values set in the config file.

import { Config } from '@bithero/webapp-prerender';

export default {
    port: 4322,
    minifyHtml: true,
    emptyOutput: true,
    puppeteer: {
        executablePath: '/usr/bin/chromium',
} as Config;

For more information, look at the Config interface exported from @bithero/webapp-prerender.


Inspired by react-snap.