swc-project / swc-project/swc-node

Relative import is not resolved if module name starts with dot

Open
#976 1 comment 0 reactions 0 assignees View on GitHub

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.

swc-node-issue.zip

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.