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

Supporting virtual:* modules? #986

Open
quick-vite opened this issue Feb 23, 2025 · 0 comments
Open

Supporting virtual:* modules? #986

quick-vite opened this issue Feb 23, 2025 · 0 comments

Comments

@quick-vite
Copy link

quick-vite commented Feb 23, 2025

Hi,

Vite offers a plugin construct where you can define "virtual modules". ( import packageName from 'virtual:{package-name}')
In short, when bundling you can refer to this "module" and inject code into the bundle.
This can be very useful for including build-time generated framework metadata for example.

Currently, when you try to compile a JSR package using this construct you get an error:

error: Unsupported scheme "virtual" for module "virtual:{package-name}". Supported schemes:
 - "blob"
 - "data"
 - "file"
 - "http"
 - "https"
 - "jsr"
 - "npm"
    at file:///home/runner/work/file.mts:3:27
Child process exited with: 1
 ELIFECYCLE  Command failed with exit code 1.
Error: Process completed with exit code 1.

I'm not sure if it's in JSR's interest to support this, because it seems to check whether your dependencies actually resolve.
(I tried replacing it with npm:virtual:{package-name} and got an error because of that.
But I figured I'd make an issue anyway so it's documented if JSR doesn't want to support it.

@github-project-automation github-project-automation bot moved this to Needs Triage in JSR Feb 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Needs Triage
Development

No branches or pull requests

1 participant