This little script saves me thousands of keystrokes and hours of wasted time while building SPFx (SharePoint Framework) solutions. Generating a production level build is one of the most annoying parts of building SPFx solutions. In the Visual Studio world we could just hit a button and BAM! a package shot out the other end. Well, that is not entirely the case with SPFx. First I have to ‘gulp clean’ then ‘gulp build’ then ‘gulp bundle’ then ‘gulp package-solution’ then go to the folder. This gets old quick, at least for me it did. There were a few ways I tried to fix this and the simplest way was to make a batch file that would call all the commands. I’m sharing this with you so that you don’t have to do any experimentation or try writing your own.



New call-to-action


call gulp clean

call gulp build --ship

call gulp bundle --ship

call gulp package-solution --ship

call explorer .\sharepoint\solution\

Put this file in the root of your SPFx project and run it in the command line. Of course you have to watch for errors. This is something I usually run one I know i have a clean + working build. Don’t forget to increment your build numbers 🙂 Happy coding!

About the Author

Developer, Designer, Thinker, Problem Solver, Office Servers and Services MVP, & Collaboration Director @ SoHo Dragon.

View Articles