Skip to content

Very slow compilation with allowJs #10157

Closed
@normalser

Description

@normalser

TypeScript Version: 2.1.0-dev.20160803

Trying to migrate medium size js project to ts so I am using allowJs: true in tsconfig.json and have mix of ts (10%) and js (90%) files already

Unfortunately compilation time with allowJs:true is 23 seconds while with allowJs:false is 3 seconds.

Problem seems to be that all js files follow the node_modules ("moduleResolution": "node" in tsconfig.json)

Is there any way to have moduleResolution:classic for JS part while node for TS or some other way to configure the project so that js files are not so deeply analyzed.

Here are the stats:

with allowJs:true

time tsc -p . --traceResolution | wc -l
  154171
tsc -p . --traceResolution  23.37s
time tsc -p . --traceResolution | grep node_modules | wc -l
  148740
tsc -p . --traceResolution  23.41s

with allowJs:false

time tsc -p . --traceResolution | wc -l
  1498
tsc -p . --traceResolution  3.03s
time tsc -p . --traceResolution | grep node_modules | wc -l
  1392
tsc -p . --traceResolution  3.02s

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs More InfoThe issue still hasn't been fully clarified

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions