3

I've started experimenting with SPFx and going through the tutorials. One thing I realized is that the web part folders are enormous in size. Is this normal?

The basic HelloWorld folder created by Yeoman generator is 500MB!

Is this same for everyone or a problem with my environment?

3

That is completely normal due to upstream dependencies used by SPFx.

You can however reduce this if you the pnpm package manager because it reuses the packages.

So, next time you create a new solution, it will check the local file system and will only download packages which are missing otherwise it will link them to your solution.

To use that, you need to install pnpm package manager.

References - Using pnpm with SPFx

3
  • thank you so much! do you know how much it reduces? It's just utterly shocking for a helloworld webpart to be that big... – ova Jun 18 '20 at 14:37
  • Yep, plain crazy !!! Its is a significant reduction. Take a look at this video where the number of files reduced from 50,000 to 1000 while using pnpm - youtube.com/watch?v=gCwV58BVWMU – Gautam Sheth Jun 18 '20 at 14:45
  • Thanks so much Gautam! – ova Jun 18 '20 at 15:30
4

Yes this is normal.

This folder size is mostly because of node_modules folder in your SPFx project.

If you want to share the SPFx package with anyone, you can share it by excluding the node_modules and include all dependencies in package.json file.

After sharing it other developers can run npm install command in project folder and it will download all dependencies in node_modules folder.

Similar Question: The size of the node_modules folder in a project is really big

Other References:

Optimize SharePoint Framework builds for production

1
  • 1
    omg this is plain crazy! Thanks for your answer though! – ova Jun 18 '20 at 14:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.