codesandbox / codesandbox/codesandbox-client
Packages that use npm aliases will throw errors during compilation
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 13.6k
- Forks
- 2.4k
- Avg merge
- 6d 19h
- Merged PRs (30d)
- 2
Description
🐛 bug report
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project
adheres to. - 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 |
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 with the linked CodeSandbox reproductions and confirm the ModuleNotFoundError when an npm package alias is used, including the @swc/helpers example. Trace the compilation and module-resolution entry point that handles the aliased package, then verify that both reproductions compile successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100