Comments (20)
Was also getting this issue on Windows 10 causing 100% CPU usage
from import-cost.
Same on Mac OS 10.13.1. Interestingly it didn't show high CPU usage in Activity Monitor, I only knew something was up because my CPU temps were about 70c.
from import-cost.
Hi everybody, terribly sorry for this. The issue was introduced in the last release and I am now working on a fix.
from import-cost.
Confirmed on Fedora 27 x64, VS Code 1.19.0.
Import Cost is eating 100% of CPU plus it stays open after quitting VS Code (which may be another issue, or may be the related to the same problem). Disabling it "fixes" the problem.
from import-cost.
+1
from import-cost.
Same on Windows 10 with
import difference from 'lodash-es/difference';
import includes from 'lodash-es/includes';
Calculating
is shown forever and CPU goes up to 100%.
from import-cost.
Fixed in version 2.6.2. Plz update if you see more such issues. Thanks and again sorry for this!
from import-cost.
I found the cause of the problem, The following code will cause high CPU usage.
import Transition from 'react-transition-group/Transition';
Because the installation directory for the react-transition-group is like this
--node_modules/
|---- react-transition-group/
|----dist/
|----utils/
|----node_modules/
|----CSSTransition.js
|----index.js
|----Transition.js
|----TransitionGroup.js
|----README.md
|----package.json
|----License
import-cost will lead to result in an error
[Extension Host] debugger inspector at %cmodule.js:472
throw err;
^
Error: Cannot find module '..../node_modules/react-transition-group/Transition/package.json'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at calcSize (.../.vscode/extensions/wix.vscode-import-cost-2.6.0/node_modules/import-cost/dist/src/webpack.js:34:21)
at handle (..../.vscode/extensions/wix.vscode-import-cost-2.6.0/node_modules/worker-farm/lib/child/index.js:44:8)
at process.<anonymous> (..../.vscode/extensions/wix.vscode-import-cost-2.6.0/node_modules/worker-farm/lib/child/index.js:51:3)
at emitTwo (events.js:106:13)
at process.emit (events.js:194:7)
at process.nextTick (internal/child_process.js:766:12)
The code segment:
https://github.com/wix/import-cost/blob/master/packages/import-cost/src/webpack.js#L20
const importedPkg = require(path.join(modulesDirectory, packageInfo.name, 'package.json'));
from import-cost.
Same here on Mac OS 10.13.2, VSCode 1.19.1 and Import Cost 2.6.0
from import-cost.
Ok I commented in the macOs thread, but it's the same...
So here I paste the link to it: #47 (comment)
from import-cost.
Same here on Ubuntu 17.10. Glad I figured out which extension was slowing my machine down. 😠
from import-cost.
@jruif From your example it looks like it thinks Transition is a directory from the import ('react-transition-group/Transition'
) and so looks for a package.json file where one does not exist; getting package.json from react-transition-group
instead of react-transition-group/Transition
would be the desired effect.
Curious why that causes such a CPU spike.
In any case, this seems to be a recent issue as a side effect of b33b3eb, since that line you traced is only introduced with that commit.
from import-cost.
I am flagging the issue here as it seems closely related. When VSCode cant find a module that you are requiring it will result it high CPU load instead of a graceful error message. In the screen shot I am requiring individual methods from the 'express-validator' library. Since VSCode cant find it, it seems to go into free-fall and repeatedly throws the same error message as can be seen from the developer view.
It took me a while to figure out what was going on and I considered going back to Sublime Text after two weeks. The editor should be giving a friendly warning not turning my work station into a fan heater :-)
My work around for now is to simply comment out the code and to restart VSCode.
from import-cost.
Can someone change the title to Ubuntu
instead of Ubunto
? I did not find this post the first time due to that (searched for 'Ubuntu', got zero results).
from import-cost.
from import-cost.
Yeah, and that's why there's already a MacOS issue, and that's why I wrote my problem there (and not here) ... #47
from import-cost.
Hi I'm on the VS Code team, there have been several reports on our repo and on Twitter which mostly seem to point to this extension. @shahata has any progress been made? This is affecting a lot of users.
Also #47 can be merged into this issue.
from import-cost.
@shahata do you think that this fix is also relevant to #35? So we can close this too.
from import-cost.
@maxibanki actually you reported that memory leak before I released the version with the bug, so that might be something different. Are you no longer seeing the memory leak?
from import-cost.
I'm currently not using the extensions anymore, but I will reinstall to test it. Do you think, that 1,7GB of memory usage is normal? Let's use my thread for forther discussions. :)
from import-cost.
Related Issues (20)
- Save lag when I import a type or interface
- profile 2758.69ms导致保存卡顿
- Very high ms: 1747ms
- Crashing editor HOT 1
- SVG logo for extension and Marketplace
- Uncaught error
- high CPU usage ~60%
- VS Code Insiders: Extension Host Termination and Conflict Between ImportCost and Copilot
- Blocking UI on long tasks
- Option to disable or clear cache
- Keeps killing JS debug terminal once started on VS-Code
- Keeps restarting the whole extension host
- pnpm return size of 0 HOT 1
- Crashes the extension host
- Import-cost crashing extension host after latest vscode insider update
- Doesn't show anything in yarn berry + yarn monorepo project
- Keeps crashing vscode extensions
- Import Cost extension causing time waste on save / eslint / import HOT 2
- Unable to resolve size for dual published ESM and CJS HOT 1
- Takes so long to save file HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from import-cost.