Skip to content

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

@snoweuph

Description

@snoweuph

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions