Skip to content

[feature] Prebundle workspace dependencies #2241

@remorses

Description

@remorses

Is your feature request related to a problem? Please describe.
The biggest problem in vite performace is the number of files served to the browser, this becomes very big in case most of your code is placed in workspaces (which are not prebundled by vite)

To decrease the number of es modules served in big monorepos Vite could prebundle workspaces dependencies to signle files (still with node modules externalized, to prevent duplication of dependencies)

Describe the solution you'd like
Bundle workspaces in single files bundles

On workspace files change, rebundle the files again

React refresh and other plugins would still be applied, this means that workspaces would need to be bundled with rollup instead of esbuild

Describe alternatives you've considered

Additional context
This would allow to set typescript or vue files as main for internal packages, which would remove a lot of tooling in a typical private monorepo

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestfeat: deps optimizerEsbuild Dependencies OptimizationperformancePerformance related enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions