Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Vite for Figma Plugins (multi-page app: lib + regular entry) #3314

Closed
gossi opened this issue May 8, 2021 · 1 comment
Closed

Using Vite for Figma Plugins (multi-page app: lib + regular entry) #3314

gossi opened this issue May 8, 2021 · 1 comment

Comments

@gossi
Copy link

gossi commented May 8, 2021

Using Vite to Develop Figma Plugins

I want to use vite to develop figma plugins. Figma plugins run two processes.

  1. runtime (sandboxed code running "inside" figma files)
  2. 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.

Additional context

@bluwy
Copy link
Member

bluwy commented Mar 7, 2022

Vite is currently able to build for multiple pages like so. But if you're requesting to do multiple builds at once, I don't think that's planned for Vite as it has been built based on a single output only. Evan made a comment about it too #2039 (comment). Your best bet is with the multi-process setup now.

@bluwy bluwy closed this as completed Mar 7, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Mar 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants