farm-fe / farm

Extremely fast Vite-compatible web build tool written in Rust
https://farmfe.org
MIT License
4.35k stars 145 forks source link

Farm client similar to Vite's. For backend integration. #1507

Open nick4814 opened 5 days ago

nick4814 commented 5 days ago

What problem does this feature solve?

Currently I can't use Farm as I require Vite-like client functionality. I am working on backend integration and there are no plugins for my framework.

https://vitejs.dev/guide/backend-integration.html#backend-integration

With Vite I would:

  1. Programmatically add @vite/client script to the HTML page when in dev mode.
  2. Programmatically add TS/SCSS/other assets into the HTML page when in dev mode. In production, this would be JS/CSS/etc.
  3. Start my app/Vite's dev server
  4. Have HMR working

Example HTML:

What does the proposed API look like?

This does not currently exist in Farm, but does in Vite. See https://vitejs.dev/guide/backend-integration.html#backend-integration.

Proposed:

Jayllyz commented 3 days ago

Template repos with some modern backend framework like Hono, Fastify or Elisya could be really helpful.