You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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 correspondingisAbc
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
The text was updated successfully, but these errors were encountered: