fix(nitro): update firebase preset to handle mjs output (#1360)

This commit is contained in:
Daniel Roe 2021-10-22 12:57:21 +01:00 committed by GitHub
parent a55c19c53b
commit 018302cb0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -53,10 +53,10 @@ async function writeRoutes ({ output: { publicDir, serverDir }, _nuxt: { rootDir
return obj return obj
}, {} as Record<string, string>) }, {} as Record<string, string>)
let nodeVersion = '12' let nodeVersion = '14'
try { try {
const currentNodeVersion = fse.readJSONSync(join(rootDir, 'package.json')).engines.node const currentNodeVersion = fse.readJSONSync(join(rootDir, 'package.json')).engines.node
if (['12', '10'].includes(currentNodeVersion)) { if (['16', '14'].includes(currentNodeVersion)) {
nodeVersion = currentNodeVersion nodeVersion = currentNodeVersion
} }
} catch {} } catch {}
@ -66,7 +66,8 @@ async function writeRoutes ({ output: { publicDir, serverDir }, _nuxt: { rootDir
JSON.stringify( JSON.stringify(
{ {
private: true, private: true,
main: './index.js', type: 'module',
main: './index.mjs',
dependencies, dependencies,
devDependencies: { devDependencies: {
'firebase-functions-test': 'latest', 'firebase-functions-test': 'latest',