Я пытаюсь запустить приложение Next JS, развернутое через Firebase, на URL-адресе root, но, похоже, оно работает только на /next
, это связано с некоторыми проблемами для путей моих активов, и я просто хочу его работать по root URL. Если я go на root URL теперь получаю эту ошибку:
![enter image description here](https://i.stack.imgur.com/m3icz.png)
Как мне заставить его работать на root url https://europe-west2-myfirstflutterapp-xxxxx.cloudfunctions.net/
вместо https://europe-west2-myfirstflutterapp-xxxxx.cloudfunctions.net/next
?
Мой firebase.json
:
{
"hosting": {
"public": "./public",
"rewrites": [
{
"source": "**",
"function": "next"
}
]
},
"functions": {
"source": "functions"
}
}
Мой functions/index.js
:
'use strict';
const functions = require('firebase-functions');
const next = require('next');
const path = require('path');
const dev = process.env.NODE_ENV !== 'production';
// const app = next({dev, dir: path.join(__dirname, '../'), conf: {distDir: 'next'}});
const app = next({dev, conf: {distDir: 'next'}});
const handle = app.getRequestHandler();
exports.next = functions.region('europe-west2').https.onRequest(async (req, res) => {
console.log('File: ' + req.originalUrl); // log the page.js file that is being requested
await app.prepare();
handle(req, res);
});