Description
Using Vite to Develop Figma Plugins
I want to use vite to develop figma plugins. Figma plugins run two processes.
- runtime (sandboxed code running "inside" figma files)
- UI part of your addon (ui part running in an iframe).
The former can be done using library mode, the latter is for what vite is build for. Figma plugins are to some extend a multi-page app.
The problem: They can't be controlled through one vite process. These two things interfere with each other. The runtime slips into the ui process and vice-versa.
Suggested solution
Rollup allows an array for each bundle; vite is combining them in one (allows only one?). I'd wish for a more dedicated control over such multiple bundles. That would serve the purpose here, yet I think the advantages of this will shine at other/similar use-cases, too.
Alternative
Two separate vite processes, each with its own vite.config.js
. That's a current workaround, but running them in parallel through npm-run-all
isn't giving the best of feedback while developing.