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

Incorrect module resolution #10572

Closed
mhevery opened this issue Aug 26, 2016 · 1 comment
Closed

Incorrect module resolution #10572

mhevery opened this issue Aug 26, 2016 · 1 comment
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@mhevery
Copy link

mhevery commented Aug 26, 2016

TypeScript Version: Version 2.1.0-dev.20160826

Code
https://github.com/mhevery/ts-resolution-bug

Expected behavior:

Actual behavior:

The project tries to compile a index.ts which imports @types/node. Internally @types/node has http module. TS then assumes that http module is http.ts in the current project and compiles it. I think that is incorrect behavior.

It is strange that a file in node_modules can control which files get compiled in my project. I think that once trace resolution enters node_module it should not be allowed to escape out of it.

@mhegazy
Copy link
Contributor

mhegazy commented Aug 26, 2016

the issue is the baseUrl set to the current folder. this makes the compiler defaults to searching there. regardless i agree that resolving an import from "node_modules" should not result in a local file. we need to think of a way to avoid this.

@mhegazy mhegazy added the Bug A bug in TypeScript label Aug 26, 2016
@mhegazy mhegazy added this to the TypeScript 2.1 milestone Aug 26, 2016
@mhegazy mhegazy assigned ghost Aug 26, 2016
@mhegazy mhegazy modified the milestones: TypeScript 2.1, TypeScript 2.1.2, Future Oct 27, 2016
@vladima vladima added the Fixed A PR has been merged for this issue label Nov 2, 2016
@vladima vladima closed this as completed Nov 2, 2016
@mhegazy mhegazy modified the milestones: TypeScript 2.1.2, Future Nov 2, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

3 participants