S
SolidJS3mo ago
SammyK

Build process with solidstart

Hi I'm looking into using solidjs with SolidStart primarily for its build process. However, I have a few questions: What should I consider when integrating a router (the default solid router) with SolidStart, particularly if I'm focusing on a simple client-side rendered application? Can I configure SolidStart's build process (using Vinxi) to output a minimal set of files such as index.html, style.css, and script.js directly? If so, could you guide me on what specific settings or configurations I need to adjust? Are there any caveats or limitations I should be aware of when using SolidStart in this manner, particularly when I only have "external" API interactions, but want to structure the frontend with the folder structure of solid-router? Any guidance or tips would be highly appreciated!
4 Replies
Brendonovich
Brendonovich3mo ago
Can I configure SolidStart's build process (using Vinxi) to output a minimal set of files such as index.html, style.css, and script.js directly?
Yes, you can use server: { preset: 'static' } in the SS config to build all the files you need into .output/public. It won't support API routes or server functions, but that can be changed by using a preset that supports server stuff. Everything else should work fine.
SammyK
SammyK3mo ago
Thank you for clarifying. Given that I will be using a static preset and my application will primarily interact with an external JSON API, should I use createResource for handling asynchronous data fetching, or is there another method or practice recommended within SolidStart for such scenarios?
Brendonovich
Brendonovich3mo ago
Since you'll be using solid-router, it's recommended to use cache, action, createAsync etc, which you can read about in the readme. But createResource would be fine, or if you want more advanced caching then something like tanstack query is great
SammyK
SammyK3mo ago
Thank you!