Skip to content

Firebase Hosting

Firebase Hosting serves static content from a global CDN. pageflare runs as a post-build step before firebase deploy, optimizing your site’s HTML, CSS, JS, and fonts.

Add pageflare to your package.json build script. Firebase CLI deploys whatever is in your configured public directory — pageflare optimizes those files in place before the deploy happens.

Terminal window
npm install -D @pageflare/cli

Update your package.json build script to include pageflare:

package.json
{
"scripts": {
"build": "astro build && npx @pageflare/cli dist/ --in-place --no-progress",
"deploy": "npm run build && firebase deploy"
}
}

Make sure firebase.json points to the correct output directory:

firebase.json
{
"hosting": {
"public": "dist",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"]
}
}

Set PAGEFLARE_LICENSE in your CI environment, or locally via .env:

Terminal window
# Local development
export PAGEFLARE_LICENSE=your-license-key
# GitHub Actions
# Add as a repository secret, then reference in your workflow

After building, check the terminal output for the pageflare summary:

Done 145.2 KB saved (38.1%) 1.2s
Files 42 total, 38 optimized, 4 unchanged, 0 errors
FrameworkOutput directoryfirebase.json public
Astrodist/dist
Next.js static exportout/out
Hugopublic/public
Vitedist/dist
Docusaurusbuild/build

pageflare processes 0 files The directory in your build script doesn’t match where your framework writes output. Check the table above and update accordingly.

Deploy includes unoptimized files Make sure pageflare runs before firebase deploy, not after. The --in-place flag overwrites the files so Firebase deploys the optimized versions.