'Set css route for nested routes in Nuxt

I have a Nuxt site deployed on Firebase roughly following this video for SSR configuration, it works great when navigating to the homepage and then going to any other route, however when going directly to, say, /products/1 the HTML is rendered server-side just fine, but it's trying to load the css from /products/css/[hash].css.

How can I set the route for these static files so that it always looks for them in '/', and not the subroute.

I've looked over the Nuxt config documentation and don't think I see an option to change that.

My index.js on my functions folder is as follows, if that helps:

const functions = require('firebase-functions');
const { Nuxt } = require('nuxt');
const express = require('express');

const app = express();

const config = {
    dev: false,
    buildDir: 'nuxt',
    build: {
        publicPath: '/'
    }
};

const nuxt = new Nuxt(config);

function handleRequest(req, res) {
    res.set('Cache-Control', 'public, max-age=600, s-maxage=1200');
    nuxt.renderRoute('/')
        .then(result => {
            res.send(result.html);
        })
        .catch(e => {
            res.send(e);
        });
}

app.get('*', handleRequest);

exports.ssrapp = functions.https.onRequest(app);


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source