Skip to content

Export markExplicitImport  #8608

@ggoodman

Description

@ggoodman

Clear and concise description of the problem

When authoring a Plugin, it is sometimes desirable to trick ViteDevServer into thinking that a file is JavaScript even when its extension would normally indicate to Vite otherwise.

For example, it may be desirable to import non-js, non-css files without creating intermediate virtual files with a .js or .css extension. In this situation, we would find ourselves fighting against Vite's built-in logic and wanting to do something like the Import Analysis Plugin (like this).

Suggested solution

Export markExplicitImport and perhaps the corresponding isAbc functions. This would allow Vite to treat these annotations as internal implementation details instead of the sort of accidental public (to plugins) contract.

Alternative

I didn't come up with any.

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