dividab / tsconfig-paths

Load node modules according to tsconfig paths, in run-time or via API.
MIT License
1.82k stars 104 forks source link

Conflicting module names. #88

Closed deskoh closed 4 years ago

deskoh commented 5 years ago

See repo here.

There is an import

import mongoose from 'mongoose';

However, the baseUrl will cause the mongoose to be resolved to the local mongoose.ts instead of the mongoose package in node_modules.

The VS Code editor and language server seems to resolve it fine (e.g. goto definitions works).

Any way for the modules in node_modules to take precedence?

ajmeyghani commented 4 years ago

How does your tsconfig.json look like? You can try explicitly setting your alias paths, for example:

    "baseUrl": "./",
    "paths": {
      "*": ["node_modules/*"],
      "@hooks/*": ["src/hooks/*"]
    }
deskoh commented 4 years ago

Issue seemed to be fixed now.

balasan commented 4 years ago

still seeing this issue with v3.9.0 in my case it was importing a local src/queue.js file instead of the queue npm module from node_modules

adding "*": ["node_modules/*"], to paths solved the issue for me but it feels a little hacky