Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export markExplicitImport #8608

Closed
4 tasks done
ggoodman opened this issue Jun 15, 2022 · 2 comments
Closed
4 tasks done

Export markExplicitImport #8608

ggoodman opened this issue Jun 15, 2022 · 2 comments

Comments

@ggoodman
Copy link

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

@bluwy
Copy link
Member

bluwy commented Jun 16, 2022

Maybe related to #3828 and sveltejs/vite-plugin-svelte#60. The idea is to tell Vite what assets are JS and non-JS.

Side topic: This also seems somewhat related to optimizeDeps.extensions, and maybe we could unify it somehow.

@bluwy
Copy link
Member

bluwy commented Nov 23, 2022

Closing this in favor of #9963 (comment) as it has a linked PR and discussion there (even though it's created later).

@bluwy bluwy closed this as not planned Won't fix, can't repro, duplicate, stale Nov 23, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Dec 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants