为Nuxt.js部署云功能错误

问题描述 投票:0回答:2

有没有办法部署云功能,在Firebase中为Nuxt启用服务器端渲染,因为Firebase上使用的节点是版本6.11.1,Nuxt版本1及以上版本的最小节点版本是8.每次部署该功能时,它都会获得像这样的错误

Deployment Error

我也添加了像这样的Babel配置,但它仍然没有用。

babel: {
  'presets': [
    'es2015',
    'stage-0'
  ],
  plugins: [
    ['transform-runtime', {
      'polyfill': true,
      'regenerator': true
    }]
  ]
}
javascript firebase vue.js vuejs2 nuxt.js
2个回答
2
投票

根据相关的nuxt.js问题

https://github.com/nuxt/nuxt.js/issues/2714#issuecomment-393868687

The latest build of nuxt-edge supports Node 6.x again by automatically falling back to the legacy build.

因此a

npm install -S nuxt-edge babel-polyfill

应该现在解决你的问题


1
投票

您需要在部署之前执行某些操作,以确保编译代码并将其放置在Firebase CLI找到部署代码的正确位置。这将高度依赖于您自己的设置。如果您使用Firebase CLI创建JavaScript项目,它将需要在您的函数文件夹中部署所有内容,并且您将需要一个index.js作为您的函数定义。如果要更改部署文件夹,可以在firebase.json中的“functions”节中执行此操作。也许predeploy hook会让你更容易。

在我看来,如果你想要高级的JavaScript语言功能,比如async / await,那么tell the CLI to create a TypeScript project就容易多了。它会自动安排在部署之前将TypeScript编译为JavaScript,因此除了运行deploy命令之外,您不必执行任何操作。

© www.soinside.com 2019 - 2024. All rights reserved.