Skip to content

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

Closed
@gossi

Description

@gossi

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions