-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Support loading jsr module specifiers and transpile its commonjs dependencies #20003
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
Comments
Hello @danielbeeke. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with |
From the description alone, it's not clear what you are trying to do. Can you provide a reproduction to show what errors you are getting? |
The MWE is here: |
Can you also include that part? |
Deno has a Vite plugin that supports this: https://github.com/denoland/deno-vite-plugin. I'm not sure about the commonjs part but in any case it doesn't seem like something Vite-specific and would be handled in the plugin instead |
Here it is: |
The problem with plugin is that you probably need to do dependency tree resolution because the pre-bundling runs before the plugins. |
Description
As a developer using Vite and jsr.io I would like to be able to load module specifiers such as
npm:@iconify-icon/react@^3.0.0/dist/iconify.mjs
in Vite while using node and NPM.The part that is not working, is picking up the module specifiers and then transpiling commonjs modules.
Suggested solution
Support loading specifiers such as
npm:@iconify-icon/react@^3.0.0/dist/iconify.mjs
by rewriting them toiconify-icon/react/dist/iconify.mjs
and also triggering the commonjs plugin on it to transpile to the contents.Alternative
I tried creating a plugin for this. For resolveId I was able to get it to work, however the commonjs part seems to be a separate process where it is statically calculated. Is this a correct assumption?
Additional context
Related issue on jsr repo:
jsr-io/jsr#1097
Validations
The text was updated successfully, but these errors were encountered: