Here's my nuxt.config.js
// https://nuxt.com/docs/api/configuration/nuxt-config
// eslint-disable-next-line no-undef
export default defineNuxtConfig({
preset: 'node-server',
modules: [
'@nuxtjs/tailwindcss',
],
nitro: {
preset: 'firebase',
},
srcDir: './src',
});
I want to change the functions name which is server by default to something else. There seems no option in nitro or nuxt config to do that.
In the .output/server/index.mjs in line 4, the default export name is server
// line 4
export { s as server } from './chunks/nitro/firebase.mjs';
Just BTW I am having the same problem I think. I want to deploy multiple nuxt3 apps on firebase hosting as websites under one common project. But I need one "server" function to be setup for each nuxt app. Supposedly with a unique name to match with my hosting config. Now the "server" cloud-function is overwritten each time I deploy any nuxt hosting. @jofftiquez is that the same problem you are trying to solve?
I was able to change the function name patching the output/server/index.mjs file generated by the build comand (actually I use a predeploy script with regex to do that): from
export { s as server } from './chunks/nitro/firebase.mjs'
to
export { s as custom-server-name } from './chunks/nitro/firebase.mjs'
then in firebase.json I configured my custom function name:
And I was able to deploy the function "custom-server-name" with:
firebase deploy --only functions:custom-server-name --project=default
It's the only approach I found so far. You can investigate in the
codebase
key under thefunctions
in firebase.json. If you deploy from seperate repos it's usefull.my script stub:
Currently I moved the script above into my pipeline script and run it before
firebase deploy
The
function: predeploy
key in firebase.json or any manual command calling the script should do it as well. Depends on your setup.