Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build size #27

Open
s4cha opened this issue Jul 3, 2024 · 8 comments
Open

Build size #27

s4cha opened this issue Jul 3, 2024 · 8 comments

Comments

@s4cha
Copy link

s4cha commented Jul 3, 2024

Being able to spawn a Swift API in a few lines of code without worrying about infrastructure is truly a game changer !
I set up a tiny API with a few lines of code.
Whenever I do swift package --disable-sandbox vercel deploy --prod it uploads 90+MB.
That looks fairly massive for a tiny api. I guess it might come from all the dependencies such as vapor for example. In my case I am using a bare ExpressHandler. Would there be a way to shed all the dependencies we don't need from the build to make it lighter ?
PS: If I can be of any help let me know, I think this project is incredibly underrated !

@AndrewBarba
Copy link
Contributor

Thanks for opening this, I'm actively investigating size issues. I thought it might be cause of Vapor but if you're using Express handler then there's no additional dependencies. Will keep you updated

@s4cha
Copy link
Author

s4cha commented Jul 4, 2024

I am using Express handler and not explicitly importing Vapor but it is pulled as a dependency package so I'm afraid it still ends up in the final build.

@AndrewBarba
Copy link
Contributor

@s4cha I identified the issue to be the new fetch implementation using async-http-client. Turns out that package is adding some 40mb to the binary. I need to revert this implementation and go back to URLSession. Will update you when I make that change

@hartti
Copy link

hartti commented Jul 10, 2024

Thanks for working on this! There seems to be a 100MB file size limit on Vercel side and one runs into that wall pretty soon with these extra MBs added on...

@henriquestiagoo
Copy link

Same issue here !

@AndrewBarba
Copy link
Contributor

AndrewBarba commented Jul 29, 2024

Hey everyone, I'm working on V2 which also reverts the use of async-http-client and resolves the size issues: #29

Please trying using the v2 branch in your package.json using from: "v2"

@henriquestiagoo
Copy link

Unfortunately, I get the same Error: File size limit exceeded (100 MB) with v2.

@matthewcheok
Copy link

matthewcheok commented Aug 19, 2024

I'm running into the same build size limitations (126MB) - and using v2 gives the following build errors:

error: cannot find type 'Response' in scope

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants