Mongoose slows down performance of VSCode (TSServer) by a lot
See original GitHub issueDo you want to request a feature or report a bug?
bug
What is the current behavior?
It slows down vscode by a lot, even with small projects. I have a very small project, with like 2 small schemas, and the 2 other files, containing on average 160 lines of code, and vscode slows down a lot as soon as I install mongoose. This does not happen when I install most other libraries (haven’t tested them all lmao). If I uninstall mongoose, it comes back and works perfectly normal. To clarify “slowing down” means that typescript language server needs 3-5 seconds to realise that I’m importing somethign invalid, and just vscode in general to realise I’m importing something that’s never used takes around 2-4 seconds. Usually it happens in under a second so like… you know… And it’s not like vscode is taking a lot of ram/cpu either, it just grows slow. Btw I think this is a mongoose issue, since it happens with no other library, its a special case here Reloading typescript server or project doesn’t help
If the current behavior is a bug, please provide the steps to reproduce.
Have vscode to edit your code
Install mongoose on your current project (npm i mongoose
My tsconfig.json:
{
"compilerOptions": {
"allowJs": true,
"moduleResolution": "Node",
"esModuleInterop": true,
"target": "ES6",
"resolveJsonModule": true,
"outDir": "./dist",
"checkJs": true,
"module": "CommonJS",
"lib": ["ESNext"]
},
"include": ["src"]
}
What is the expected behavior?
It to not be like this, lmao.
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that “latest” is not a version.
Node: v16.2.0 Mongoose: 5.12.13 Linux: 5.12.7-arch1-1
Issue Analytics
- State:
- Created 2 years ago
- Reactions:72
- Comments:217 (51 by maintainers)
Decided to give it one more shot by taking into consideration feedback by @TigranAvagyan18. And I got it to work!
Commands:
Summary:
My existing code worked with these versions without issues. Code completion performance is also back! It feels so good to have the snappy completion back.
As a side note, Mongoose introduced their own types in version 5.11.0 according to this. 5.10.19 was the last version released before that according to this
I will test some more tonight to see if my current code was affected by this downgrade and update this post if I find any.
This really needs a fix… Programming is not possible like this.