An annoyed cat looking at a computer monitor. the image is in pixel art

Deploy Astro to Firebase with a custom build script

The steps required to create a custom build script for Astro and deploy it to firebase

This article will be a 1 min read.

This blog post was last updated on: 8/21/2023.

Whenever you want to use a custom deploy script with astro you will get this dreaded warning:

WARNING: Your package.json contains a custom build that is being ignored. Only the Astro default build script (e.g, “astro build”) is respected. If you have a more advanced build process you should build a custom integration https://firebase.google.com/docs/hosting/express

The bad part about it is that it’s not super comprehensive. because if you use the serve directory as dist, it will not work. You need to use the client directory to make it work.

TLDR: Append this in your package.json file.

package.json
{
"scripts": {
"build": "astro build && another-build-script"
},
"directories": {
"serve": "dist/client"
},
"files": ["dist/client", "dist/server/entry.mjs"],
"main": "dist/server/entry.mjs"
}

This blog post was last updated on: 8/24/2023.