Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

node_modules slow down the VS 2017 IDE

I am working on an angular 2 project, and it is created by angular/CLI. After I opened my project by 'open -> folders,' the CPU usage been boosted to over 50% and everything becomes very slow. I tested it that the slowdown issue caused by 'node_moduls'. After I removed this folder, the IDE will back to normal.

However, in the project, I still need the 'node_moduls' folder, because I got error message everywhere if I removed the 'node_moduls' folder! Even an import from the angular core!

import { Component, OnInit, ViewChild, Input, Output, EventEmitter } from '@angular/core';)

Is any way to fix this problem?

As I can see, VS 2017 keep scanning my folders and files, and this process has been taken for 3 hours. Now the IDE still takes 30% usage of the CPU usage. I think it needs to port the VS code's folders management idea to VS 2017. enter image description here

And I have checked the "exclude" option that should show on the right-click menu. However, it does not have any option for excluding the folder.

enter image description here

update: It has been a night, (I kept the VS2017 open) the VS still taking 30-40% CPU usage, and the scanning data still on 45% same with the first image.

like image 401
infinitysky Avatar asked Mar 14 '17 09:03

infinitysky


2 Answers

Instead of using

File -> Open -> Folder

use

File -> Open -> Web Site...

UPDATE:

or (thanks wodzu)

Solution > Add > Existing Website

Navigate to the location on your hard drive where the project lives and select its directory.

Since it is after all a web site that should work fine and it doesn't perform the scan.

I had the same issue but didn't want to modify the tsconfig.json file since that configuration is used by the angular cli tool which we use to compile the app.

like image 133
Neutrino Avatar answered Nov 14 '22 02:11

Neutrino


Don't include node_modules in your VS project because it takes forever to load.

In your tsconfig.json file, you need to exclude the node_modules folder from being compiled:

"compilerOptions": 
    ...
},
"exclude": [
    "node_modules"
]
like image 27
pixelbits Avatar answered Nov 14 '22 01:11

pixelbits