-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
Process Serverless Output with Vite #1
Comments
This would be wonderful! I think it may also pave the way for Slinkity to be able to support Serverless, but maybe that's a separate issue (@Holben888 sorry to summon you—what do you think?). (Use case: I want to be able to support URL sharing and server-render React components based on query params: AleksandrHovhannisyan/fluid-type-scale-calculator#17) |
Oh ho ho, did somebody say We also wrote a thin abstraction called |
Also, an important caveat I want to mention: Vite production builds aren't the fastest around. Since they target HTML files as the entrypoint and could compile SCSS files on-the-fly as well, it's easy to creep into 1 second or more for a single page. I'm curious if certain files like <!--allowed and bundled at build time, before serverless requests-->
<link rel="stylesheet" href="/styles/staticPath.scss">
<!--not allowed!-->
<link rel="stylesheet" href="/styles/{{ params.dynamicPath }}.scss"> |
Also want to call out that Astro has 100% ruled out Vite in a serverless environment. Any bundling or analysis of non-JS assets occurs at build time, while frontmatter (essentially 11ty's data cascade) is free to process on serverless. |
@bholmesdev Does this mean that the use case I described is not possible? |
@AleksandrHovhannisyan So it's not impossible, just not recommended as the only option. the length of Vite builds and the size of the bundle make it a no-go for certain use cases. We definitely need a Vite-less option for serverless alongside the Vite-ful solution at least. |
I previously thought this wasn’t going to work because Vite was too big but I think for some projects it might work?
Would need a combination of using rollup plugin-virtual to pass strings into rollup config
rollup/rollup#3276 (comment)
https://github.com/rollup/plugins/tree/master/packages/virtual
And vite’s
build.write
false option to get the rollup output back as an objecthttps://vitejs.dev/config/#build-write
The text was updated successfully, but these errors were encountered: