swc-project / swc-project/swc-node
Relative import is not resolved if module name starts with dot
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 95
- Avg merge
- 14d 11h
- Merged PRs (30d)
- 1
Description
When we import a module starting with . (dot), I am gettubg MODULE_NOT_FOUND error.
.
├── app
│ ├── .generated
│ │ ├── client.ts
│ │ └── index.ts
│ ├── generated
│ │ ├── client.ts
│ │ └── index.ts
│ ├── dotted.ts
│ └── simple.ts
├── scripts
│ ├── test-dotted.ts
│ └── test-simple.ts
├── package.json
├── pnpm-lock.yaml
└── tsconfig.json
We have a tool that generates client code under .generated module. If we remove the . from the module name, it works fine.
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 with the attached swc-node-issue.zip and run scripts/test-dotted.ts, comparing its behavior with scripts/test-simple.ts. Trace how the .generated module is resolved and verify that imports of the dotted module work without MODULE_NOT_FOUND while the existing non-dotted case remains working.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100