Autobuild SPFx solution

Hi All,

Here today I am sharing a very small & simple script which will save your significant amount of time cleaning -> building -> bundling -> packaging your SPFx solution. To have the final package of the solution I have to enter four commands either on node command prompt or on visual studio code terminal, which are as follows:

  1. gulp clean
  2. gulp build
  3. gulp bundle –ship
  4. gulp package-solution –ship

But what if we can achieve all these four steps with just double click of the mouse. Let’s see how to do it!

  1. Navigate to your SPFx solution root folder
  2. Create a .txt file with any name for e.g. prod-build.txt
  3. Paste following script in that file and save it as prod-build.cmd
cls

call gulp clean

call gulp build

call gulp bundle --ship

call gulp package-solution --ship

call explorer .\sharepoint\solution\

You are done, just double click the prod-build.cmd file and it will run all four commands and prepare a package ready for you.

You may also like...

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: