codesandbox-client icon indicating copy to clipboard operation
codesandbox-client copied to clipboard

Packages that use npm aliases will throw errors during compilation

Open ling1726 opened this issue 2 years ago • 2 comments

🐛 bug report

Preflight Checklist

  • [x] I have read the Contributing Guidelines for this project.
  • [x] I agree to follow the 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

Any usage of npm package aliases will throw the following error in codesandbox

ModuleNotFoundError
Could not find module in path: 'fluentui' relative to '/src/App.js'

How has this issue affected you? What are you trying to accomplish?

Recently SWC started using npm package aliases, which causes this error when running code using the affected version(s) of @swc/helpers. This is tracked in issue https://github.com/swc-project/swc/issues/7843

To Reproduce

Simple repro: https://codesandbox.io/s/admiring-yalow-4hm4rk?file=/src/App.js Repro with @swc/helper - https://codesandbox.io/s/amazing-grass-h57ljv?file=/example.tsx

Link to sandbox: link (optional)

Simple repro: https://codesandbox.io/s/admiring-yalow-4hm4rk?file=/src/App.js Repro with @swc/helper - https://codesandbox.io/s/amazing-grass-h57ljv?file=/example.tsx

Your Environment

Software Name/Version
Сodesandbox Browser version
Browser Chrome and Edge
Operating System Windows

ling1726 avatar Aug 21 '23 12:08 ling1726

@ling1726 Have you found a way to get npm aliases to work?

wardoost avatar Oct 21 '24 00:10 wardoost

Any updates on this issue? Not being able to install multiple versions of the same npm package is quite limiting.

chestnutchen avatar Jun 24 '25 13:06 chestnutchen