Go to file
Mai Lapyst d4868a7c74
Add sitemap core plugin
2024-04-16 15:01:57 +02:00
bin Make bin wrapper so the cli is actualy executable 2024-04-01 07:52:59 +02:00
example Add plugin to fixup form fields 2024-04-01 01:54:20 +02:00
src Add sitemap core plugin 2024-04-16 15:01:57 +02:00
.gitignore Initial commit 2024-04-01 01:43:00 +02:00
.nvmrc Initial commit 2024-04-01 01:43:00 +02:00
LICENSE Initial commit 2024-04-01 01:43:00 +02:00
package.json Make bin wrapper so the cli is actualy executable 2024-04-01 07:52:59 +02:00
readme.md Initial commit 2024-04-01 01:43:00 +02:00
tsconfig.json Initial commit 2024-04-01 01:43:00 +02:00
vite.config.ts Fix building 2024-04-01 07:46:47 +02:00
yarn.lock Initial commit 2024-04-01 01:43:00 +02:00



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.