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 changing in the generated output/server/index.mjs file by the buil comand: 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:
"functions": {
"source": ".output/server",
"runtime": "nodejs16"
},
"hosting": [
{
"target": "dev",
"public": ".output/public",
"cleanUrls": true,
"rewrites": [
{
"source": "**",
"function": "custom-server-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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.