Vite plugin for better local Compute JS experience

I just released a Vite plugin to improve my own experience of testing/developing Fastly Compute JS apps locally. The docs are sparse at the moment but the examples should provide enough guidance.

It uses the Vite Environment API to run Vite-transformed code inside fastly compute serve without requiring full rebundle after changes. Very unpolished at the moment but the basic functionality seems to work well.

Link: GitHub - cyco130/vite-plugin-fastly: Vite environment plugin for Fastly Compute

Note: I don’t work for Fastly and this is not an officially endorsed tool.

3 Likes

Thanks for sharing this! Let us know if you have any feature requests or ideas for quality of life improvements that would make the Vite integration better!

1 Like

Thanks! The main thing that blocks further progress for me is Viceroy’s heap size limit. Vite’s so called SSR transform works by converting modules into async functions via new AsyncFunction("transformed source code"). It uses a lot of memory, hitting the heap size limit pretty quickly.

I understand the rationale of enforcing the same size limits as the production ones but it would be great help to make the option available behind a flag. It would open up the possibility of running larger Vite-based frameworks like Remix/React Router, TanStack Start, SvelteKit, and my own Rakkas.

Currently importing just React + ReactDOM goes above the heap limit without minification in dependency prebundling phase. Minification not only slows things down quite a bit, but may also stop working in Vite 8 as far as I can tell.

1 Like