swc-project / swc-project/swc-node
`@swc-node/register` broken imports
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 95
- Avg merge
- 14d 11h
- Merged PRs (30d)
- 1
Description
According to https://github.com/nrwl/nx/issues/18985#issuecomment-1704448088 - last change in @swc-node/register which added baseUrl to tsconfig broke nx generators, eg:
// /path/to/file.ts
import { something } from './subdir';
// /path/to/subdir/index.ts
export const something = 1;
This throws an error: Cannot find module './subdir/index.js'
At least such a change should not be added as a bugfix, cause it broke bacward compatibility.
This worked great in @swc-node/register@1.6.6 and has been broken in 1.6.7
Contributor guide
No contributing guide indexed for this repository
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 reproducing the import failure in @swc-node/register with the shown tsconfig/baseUrl scenario and compare versions 1.6.6 and 1.6.7. Trace how the register hook resolves './subdir' for nx generators, then add coverage for the demonstrated import; done means the import resolves without regressing the older behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100