Heroku
Heroku runs your package.json build script during deployment. pageflare integrates by adding a post-build optimization step to your build command.
How It Works
Section titled “How It Works”Heroku’s Node.js buildpack runs npm run build during deployment. Add pageflare to that script so it optimizes your site’s output before Heroku serves it.
Step 1 — Install pageflare
Section titled “Step 1 — Install pageflare”npm install -D @pageflare/cliStep 2 — Configure the Build
Section titled “Step 2 — Configure the Build”Update the build script in your package.json:
{ "scripts": { "build": "astro build && npx @pageflare/cli dist/ --in-place --no-progress", "start": "npx serve dist/" }}Using the Static Buildpack
Section titled “Using the Static Buildpack”Alternatively, use Heroku’s static buildpack. Create a static.json:
{ "root": "dist/"}Step 3 — Pro License
Section titled “Step 3 — Pro License”Set the environment variable via the Heroku CLI or dashboard:
heroku config:set PAGEFLARE_LICENSE=your-license-keyOr in the Heroku dashboard: Settings > Config Vars.
Step 4 — Verify
Section titled “Step 4 — Verify”After deploying, check the build logs in the Heroku dashboard or CLI:
heroku logs --tailLook for the pageflare summary:
Done 145.2 KB saved (38.1%) 1.2s Files 42 total, 38 optimized, 4 unchanged, 0 errorsFramework Output Directories
Section titled “Framework Output Directories”| Framework | Output directory |
|---|---|
| Astro | dist/ |
| Next.js static export | out/ |
| Hugo | public/ |
| Vite | dist/ |
| Eleventy | _site/ |
Troubleshooting
Section titled “Troubleshooting”pageflare not found during build
Heroku prunes devDependencies by default. Either move @pageflare/cli to dependencies, or set NPM_CONFIG_PRODUCTION=false in your config vars.
pageflare processes 0 files The output directory in your build script doesn’t match where your framework writes output. Check the table above.