I have created a Nuxt.js SSR App and deployed it on firebase with the following cloud function:
const functions = require("firebase-functions");
const admin = require("firebase-admin");
admin.initializeApp();
const { Nuxt } = require("nuxt-start");
const nuxtConfig = require("./nuxt.config.js");
const config = {
...nuxtConfig,
dev: false,
debug: false,
buildDir: "nuxt"
};
const nuxt = new Nuxt(config);
exports.ssrapp = functions.https.onRequest(async (req, res) => {
await nuxt.ready();
nuxt.render(req, res);
});
However, I am not really satisfied with this solution. The cold start of the cloud function results in a terrible initial page load of the app of 5-10 seconds.
Is there a better way to deploy the App and avoid those long initial page loads?