Closed benmccann closed 4 years ago
There isn't an official vercel package for Sapper apps, they simply push you to export a static app, and use their static builder.
I've discussed with them ever since the launch of now v2 about either adopting this builder, creating a builder, or providing any sort of support for real Sapper apps on now, and they initially made some promising noises, but haven't expressed any interest since, so I can only assume that it's not something they are interested in doing.
I'd still like to know what exactly this builder does and how it works :-) Does it create files matching their expected interface and put them in the api
directory? Does it do server-side route splitting? How does it get around Sapper's lack of Lambda support?
@benmccann all it does is handle building a lambda using Vercel's tools, as long as you export the polka
handler so that it can serve requests.
It then does some fancy stuff with static files, but underneath it's fairly simplistic in what it actually does.
It doesn't do route splitting. It should. We would love a PR ;)
I'm targeting Kubernetes, so probably won't send a PR for this one :smile: I'm just trying to understand why this project is necessary to help review the documentation PR
It's pretty basic:
It runs the build command: https://github.com/thgh/now-sapper/blob/9fe8017f0c555d256a40225e352acbe75bf110f8/index.js#L37
Gathers all build files: https://github.com/thgh/now-sapper/blob/9fe8017f0c555d256a40225e352acbe75bf110f8/index.js#L51
Serves as much statically as possible: https://github.com/thgh/now-sapper/blob/9fe8017f0c555d256a40225e352acbe75bf110f8/index.js#L66-L72
And falls back to the server for everything else: (which is completely missing in the official package) https://github.com/thgh/now-sapper/blob/9fe8017f0c555d256a40225e352acbe75bf110f8/index.js#L73
Thanks! That's super helpful!
I'm somewhat surprised because there are several people saying that sapper doesn't work on lambda, but you've somehow not run into this problem!
Well, there were some issues with the port https://github.com/thgh/now-sapper/issues/8 which meant you couldn't use this.fetch
for local urls but it's seems to work now. It should be doable to run sapper on lambda, replace @now/node-bridge
by aws-serverless-express
and it will probably work.
I'm wondering why this project is needed instead of using the official
vercel
package. I gather from other sources that the officialvercel
package doesn't work, but it's not exactly clear to me why that is and if there's someplace we should track whether it might get fixed