farm icon indicating copy to clipboard operation
farm copied to clipboard

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

Open nick4814 opened this issue 7 months ago • 1 comments

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:

<!-- if development -->
<script type="module" src="http://localhost:5173/@vite/client"></script>
<script type="module" src="http://localhost:5173/main.ts"></script>

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:

<!-- if development -->
<script type="module" src="http://localhost:5173/@farmfe/client"></script>
<script type="module" src="http://localhost:5173/main.scss"></script>

nick4814 avatar Jul 02 '24 13:07 nick4814