When package name in dependencies and `npm:` specifier differ, Codesandbox fails to load correct URL from CDN
🐛 bug report
Preflight Checklist
- [x] I have read the [Contributing Guidelines][contributing] for this project.
- [x] I agree to follow the [Code of Conduct][code_of_conduct] that this project adheres to.
- [x] I have searched the issue tracker for an issue that matches the one I want to file, without success.
Description of the problem
Consider these dependencies in package.json:
"dependencies": {
"@solana/web3.js": "^2.0.0-preview",
"@solana/web3.js-legacy": "npm:@solana/web3.js@^1"
}
This results in this console error:
Error: Could not fetch https://cdn.jsdelivr.net/npm/@solana/web3.js@^1-legacy/lib/index.browser.esm.js
Error: Could not fetch https://unpkg.com/@solana/web3.js@^1-legacy/lib/index.browser.esm.js
Essentially something is mangling the package name, taking the -legacy string in the alias and tacking it onto the CDN URL when it should be left out.
How has this issue affected you? What are you trying to accomplish?
The modules don't load and the sandbox is unusable.
To Reproduce
Run this sandbox.
Link to sandbox: link
I hit this again today. Is this easy to fix?
Hi @steveluscher. Thanks for reporting this. I've forwarded it to our Engineering team and they will investigate. We will keep you posted on a fix.
@filipelima18 any news on this one? I am hitting this lately too
Related to dependencies here https://github.com/plotly/plotly.js/blob/master/package.json#L110
Found the issue and opened a PR with a fix. It looks like our Nodebox (in-browser Node.js runtime) did not understand npm aliases if the npm alias referred to a scoped package.
Heya! Just published the fix. You should not have the issue anymore!
@CompuIves thank you so much, confirming that this issue is now fixed for me!