codesandbox / codesandbox-client

An online IDE for rapid web development
https://codesandbox.io
Other
13.04k stars 2.27k forks source link

When package name in dependencies and `npm:` specifier differ, Codesandbox fails to load correct URL from CDN #8460

Open steveluscher opened 4 months ago

steveluscher commented 4 months ago

🐛 bug report

Preflight Checklist

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

steveluscher commented 3 months ago

I hit this again today. Is this easy to fix?

filipelima18 commented 2 months ago

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.