Skip to content

feat: support generating multiple difference versions of worker files e.g. iife and esm #8466

@okikio

Description

@okikio

Clear and concise description of the problem

Due to size of my project, I generate multiple large worker files, but vite currently only supports generating worker files in either iife mode or esm mode.

The problem is that using esm from just a treeshake perspective, drastically improves perfs. but using esm means I can't support Firefox, and using iife means a noticeable delay in load times.

Suggested solution

  • Support generating multiple different worker files, giving the user the ability to customize these files, not too different from vite's current build.lib option. The user could then on their own determine when to use which worker file in their own code.

Alternative

  • Support treeshaking iife workers, I don't know if that is possible?

Additional context

I am building an online bundler using esbuild-wasm, monaco, a bunch of fairly large plugin logic for esbuild, a couple instances of typescript, an instance of rollup, etc... All these files mean the worker file can ballon quite a bit very quickly.

Validations

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