-
-
Notifications
You must be signed in to change notification settings - Fork 37
Description
Was just considering the DX of working on FAB-level plugins after chatting to a few folks this week about the potential for this "FAB server layer" to form a really interesting layer of functionality & caching, between your user & your upstream API server. Starting with this thought bubble, but I realised that the workflow for building this kinda sucks:
Let's say you update one of your FAB plugins, and want to test it:
- If you're changing your client-side code as well, you need to
yarn build:fabto build both your app and the FAB. Even for simple apps, that takes a little while. - If you've only changed the FAB server component,
yarn fab:buildwill do it and is fairly quick, but then you do need to rekick yourfab serve fab.zipprocess and refresh the browser.
Was thinking a different workflow, but I wanted to put it out there to see what people thought of it before I lock down an api:
fab dev-server --proxy=3000 --port=3001
This would read your fab.config.json5 file, find all the plugins you're using, ignore (somehow, see below) input-{static,nextjs,sapper}, and things like plugin-rewire-assets, and actually plugin-render-html, since they're really tied to the compiled FAB. But it would live-reload the remaining plugins, and forward requests onto http://localhost:3000.
This should mean you load http://localhost:3001 as if it's your normal dev environment, but requests are moving through the FAB server code, meaning things like /api/graphql could be caught and all their logic iterated on. Hot module loading should still work with Webpack's dev server for client-side changes.
I'd need to stub out the cache module that I'm planning on introducing as part of RC2, which actually gives me a good way to dev on that, so I think this is going to happen.
Plus, I want to run fab.dev/blog as a server-rendered React Notion proxy so I can start to wean myself off gatsby. This would be a good way to test that.