Skip to content
New issue

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

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

Already on GitHub? # to your account

tsc-alias replaces path that shouldn't be replaced #109

Closed
6 tasks done
snoweuph opened this issue Mar 27, 2022 · 4 comments
Closed
6 tasks done

tsc-alias replaces path that shouldn't be replaced #109

snoweuph opened this issue Mar 27, 2022 · 4 comments

Comments

@snoweuph
Copy link

snoweuph commented Mar 27, 2022

Node Version: 16.14.2
tsc-alias Version: ^1.6.5
tsc Version: 4.5.5

I have a file structure of

src│
└───base
│   │   StateManager.ts
│   │   ...
│   
└───events
      |    ...

In My tsconfig.json I defined some paths like, there is none called 'events'

"paths": {
            "@base/*": [
                "src/base/*"
            ]
        }

and I defined the baseUrl

"baseUrl": "."

inside of the StateManager.ts I import the EventEmitter from the default package called 'events'

import { EventEmitter } from 'events';

PROBLEM:
adding the baseUrl inside of the tsconfig.json lets tsc-alias think that the import of EventEmitter from 'events' is meant to be a import of the folder named 'events'. removing the baseUrl from the tsconfig.json or just only running tsc without running tsc-alias after it "fixes" the problem, but I need to use tsc-alias because I needed to remove my relative imports because they got quite long, same thing is the reason why I need to set the baseUrl.

QUESTION:
Is there something I can do in the configuration to fix this problem with tsc-alias or could I set the removeComments flag in the tsconfig.json to false and add some type of comment that will tell tsc-aliases to do the right thing?

  • Tryed To think
  • Added Version Information
  • Told the "exact" Problem
  • been patient and waited for the reply
  • got reply
  • got some kind of fix
@raouldeheer
Copy link
Contributor

raouldeheer commented Mar 27, 2022

@snoweuph
Try this config: #79 (comment)

Duplicate of #103

@snoweuph
Copy link
Author

thx, that helped, sry for not checking the closed issues and stealing your time

@raouldeheer
Copy link
Contributor

No problem, I'll make a frequently asked questions list soon.

@snoweuph
Copy link
Author

snoweuph commented Mar 27, 2022

👍
Edit Oh wait there are reactions on Github xD

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants