Skip to content

Export fileToUrl function for plugins #7162

@Menci

Description

@Menci

Clear and concise description of the problem

Vite's some internal plugins uses the internal helper function fileToUrl, which emits asset file to dev-server/bundle and return a URL for using in generated module code. It's also very useful for external plugins to emit asset files.

Suggested solution

Export fileToUrl function from Vite and document it in the docs.

Alternative

Plugin authors could copy the code from fileToUrl from their plugins. This is very inelegant.

Additional context

No response

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