πŸ‘€ Our most exciting product launch yet πŸš€ Join us May 8th for Sanity Connect

Debugging a memory leak issue in a Next.js application with React icons.

14 replies
Last updated: Jun 12, 2023
Hey, random question here. I have a memory leak issue inside my Next js application. My node js CPU gets over 200/300% randomly.
Is there a way I can debug the code to see where the memory leak is located or what is causing it?
Jun 12, 2023, 8:20 AM
Are you using an icon package?
Jun 12, 2023, 10:25 AM
Great one! Multiple different types of reactIcons for the studio and the website. Studio is inside my next app. I am using a lot of icons
Jun 12, 2023, 10:26 AM
I found doing absolute imports lowered module count significantly
Jun 12, 2023, 10:51 AM
Jun 12, 2023, 10:53 AM
What a boss! React icons!!!!!!
Jun 12, 2023, 11:31 AM
So I have to remove all icons, do you have suggestion for a good icon library which doesn't causes these issues?
Jun 12, 2023, 11:38 AM
I think you can do something like this
Jun 12, 2023, 12:31 PM
Tried renamingReact-icons
Jun 12, 2023, 12:51 PM
Crashes
Jun 12, 2023, 12:51 PM
modularizeImports: {
    "react-icons/?(((\\w*)?/?)*)": {
      transform: "react-icons/{{ matches.[1] }}/{{member}}"
    }
  },
The package library.

But getting errors
Jun 12, 2023, 1:05 PM
guess you need to add the wight or something as well
Jun 12, 2023, 1:23 PM
I’m a regex noob
Jun 12, 2023, 1:23 PM
Kets see with chatgpt
Jun 12, 2023, 1:29 PM
πŸ˜ƒ
Jun 12, 2023, 1:29 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?