Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

paths are not resolved when './' is specified as baseUrl #15

Closed
p-chan opened this issue Jan 27, 2021 · 2 comments
Closed

paths are not resolved when './' is specified as baseUrl #15

p-chan opened this issue Jan 27, 2021 · 2 comments

Comments

@p-chan
Copy link
Contributor

p-chan commented Jan 27, 2021

Directory structure

├── package.json
├── src
│   ├── controllers
│   │   └── index.ts
│   └── index.ts
├── tsconfig.json
└── yarn.lock

./src/index.ts

import { fooController, barController } from '@controllers/index'

tsconfig.json

{
  "extends": "@stardust-configs/tsconfig/node12",
  "compilerOptions": {
    "outDir": "./dist",
    "baseUrl": "./",
    "paths": {
      "@controllers/*": ["./src/controllers/*"],
    }
  }
}

dist

└── dist
    ├── controllers
    │   └── index.js
    └── index.js

./dist/index.ts

const index_1 = require("./src/controllers/index");

-> Error: Cannot find module

@p-chan
Copy link
Contributor Author

p-chan commented Jan 27, 2021

Set the baseUrl to . /src and set paths to @controllers/*": [". /controllers/*"] to solve the problem.

However, I want the baseUrl to be '. /'.

By the way, using ts-node + tsconfig-paths works as expected.

@justkey007
Copy link
Owner

That's right, I'll see how to fix this afterwards. Thank you

@p-chan p-chan mentioned this issue Jan 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants