feat(firebase): support renaming exported server function #1377
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
π Linked issue
#266
β Type of change
π Description
Adds a new option to nitro config that allows giving a custom name to deployed firebase functions.
This is done using rollup replace. I changed the exported name for the server in the firebase entry to
__firebaseServerFunctionName__
to ensure it is unique to the firebase server export. The placeholder name is then replaced withfirebase.serverFunctionName
in the config, which is given a default value of"server"
.This change gives an intuitive way to deploy multiple servers to the same firebase project without having them be overwritten. The workaround given in #266 is not very intuitive, and could potentially break other deployments in the future.
I would also recommend adding the same option to V2 functions in #1142, since there doesn't appear to be a way to change the deployed function name in the V2 HttpOptions (I don't think
labels
does this, but correct me if I am wrong)Resolves #266
π Checklist
I have tested building my own project and the function renaming appears to work as expected. The only difference is that
export { s as server } from './chunks/nitro/firebase.mjs'
becomesexport { _ as server } from './chunks/nitro/firebase.mjs'
since the export now starts with_
before the placeholder gets replaced. I don't think this will cause any issues, but I am not 100% sure.