Skip to content

Discovering .ts files under node_modules resulting in them being compiled #6964

Closed
@billti

Description

@billti

I uncovered this general issue while testing loading JavaScript files from node_modules, but realized (and confirmed) this applies to TypeScript files also.

Basically, when we search the node_modules folder, we look for all supported extensions and add them to the compilation. Currently this means that if we find a TypeScript file in a Node module (e.g. someone published their package including the source), then we compile this also.

For example, if module sausages was published as follows (with the original source besides the compiler files):

 - node_modules
 |- sausages
   |- package.json
   |- core.ts
   |- core.js

Then we get the benefit of loading the .ts and getting the types from this. However on compiling an app which uses the sausages/core module, with outDir: "out", I get the resulting output (notice how core.js from the sausages package has been compiled into a node_modules folder in my outDir).

screen shot 2016-02-08 at 9 42 56 am

I already added a flag to denote if a file was found by searching Node modules in this pull request. I can refactor this to eliminate this issue if that seems reasonable.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions