Very slow intellisense when using MUI in VS Code

Viewed 2391

I'm using MUI for a react project and intellisense is giving me problems when it comes to speed. Suggestions won't show up for up to 4-5 seconds and I'm guessing MUI's massive library has something to do with it. Is there a way to disable intellisense for MUI specifically? If not, are there any more ways I can speed up intellisense?

package.json

"dependencies": {
  "@emotion/react": "^11.5.0",
  "@emotion/styled": "^11.3.0",
  "@mui/icons-material": "^5.0.5",
  "@mui/material": "^5.0.6",
  "@testing-library/jest-dom": "^5.15.0",
  "@testing-library/react": "^11.2.7",
  "@testing-library/user-event": "^12.8.3",
  "axios": "^0.24.0",
  "chart.js": "^3.6.0",
  "react": "^17.0.2",
  "react-chartjs-2": "^3.3.0",
  "react-dom": "^17.0.2",
  "react-reveal": "^1.2.2",
  "react-router": "^6.0.1",
  "react-router-dom": "^6.0.1",
  "react-scripts": "4.0.3",
  "web-vitals": "^1.1.2"
}
3 Answers

You should import it like this

import Tab from '@mui/material/Tab';

instead of:

import {Tab} from '@mui/material';

They might look similar, but the second one is importing the whole library and then extracting the Tab component, instead of just getting the component at once. That should help with performance.

Try importing directly from the component, rather than the whole library. I have found as long as no components are imported from the whole library, imports in a file are much faster.

import screenshot

Related