Support loading jsr module specifiers and transpile its commonjs dependencies
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 82.9k
- Forks
- 8.8k
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 61
Description
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 to iconify-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:
https://github.com/jsr-io/jsr/issues/1097
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing Vite's resolveId handling for npm: module specifiers and how the CommonJS plugin statically identifies dependencies. Verify the related JSR example and determine how rewritten specifiers reach CommonJS transformation. Done means the stated iconify.mjs specifier loads in Vite and its CommonJS dependencies are transpiled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nodejs, typescript
- Domain
- build-system, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100