在Vercel无服务器函数上部署NUXT SSR通用应用
我正在尝试在Vercel上托管使用NUXT 2构建的通用SSR应用程序。
这是 project repo ,项目总尺寸为6MB,
但是当我试图构建Vercel时,它会给它提供此功能。错误
错误:无服务器函数“索引”为124.58MB,超过50MB的最大尺寸限制。了解更多信息:https://vercel.link/serverless-function-size
错误
I'm trying to host a universal ssr app built with nuxt 2 on vercel.
Here's the Project Repo, The project total size is about 6mb
But when i try to build vercel it gives this error
Error: The Serverless Function "index" is 124.58mb which exceeds the maximum size limit of 50mb. Learn More: https://vercel.link/serverless-function-size
a screenshot of the error
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我知道已经回答了这个问题已经过去了几个月,但我也想做出贡献,也完成了同样的NUXT课程。
我将Vercel-Builder版本更改为0.22.1,如GitHub上提议的0.22.1: https ://github.com/nuxt/vercel-builder/issues/633
至于2022年11月,这解决了问题。
I know it's been some months since the question was answered but I wanted to contribute as well, having finished the same Nuxt course as well.
I changed the vercel-builder version to 0.22.1 as proposed on this issue on github: https://github.com/nuxt/vercel-builder/issues/633
As for November 2022 this solved the issue.
在这里无需添加,无服务器功能是轻巧的,并且具有很少的依赖性。
虽然NUXT2应用程序带有节点模块和很多内容。这不是无服务器功能的正确用法。
另外,如果您使用
ssr
带有target:'server'
,则您将需要一个node.js实例运行,因此Vercel也不适合。像Heroku这样的东西更适合。如果您仅使用SSG(`target:'static'),则可以。
Nothing more to add here, a serverless function is meant to lightweight and with a very few dependencies.
While a Nuxt2 app comes with node modules and a lot of things. This is not the correct usage of a serverless function.
Also, if you're using
ssr
withtarget: 'server'
, you will need a node.js instance running anyways, so Vercel does not fit either. Something like Heroku is more adapted.If you only use SSG (`target: 'static'), it may be fine.