Introduction

With the modernization of the SharePoint Framework (SPFx), Microsoft is transitioning from the traditional Gulp-based build system to a more powerful and standardized toolchain powered by Heft and Rig . This upgrade significantly improves build performance, maintainability, and future compatibility.

What Is Heft?

Heft is a command-line, configuration-driven build orchestrator developed by Microsoft as part of the RushStack ecosystem.

Key Characteristics of Heft

Heft replaces custom scripting with a clean, maintainable, and future-proof build pipeline.

What Is a Rig?

A Rig is a pre-configured build pipeline package that Heft loads to run your project's build system.

For SPFx, the rig used is:

@microsoft/spfx-rig

It contains all predefined SPFx build rules such as:

Purpose of a Rig

Why SPFx Moved from Gulp to Heft + Rig

Gulp (Old System)Heft + Rig (New System)
Custom gulpfile.js requiredNo custom scripts needed
Plugin conflicts commonRig handles all integrations
Manual orchestrationAutomated + standardized
Slower buildsFaster via caching & parallel execution
Hard upgradesEasy version upgrades via rig

This modernization brings SPFx closer to modern engineering practices used inside Microsoft teams.

How Heft Works with a Rig

The relationship can be summarized as:

Heft loads the rig and executes the build exactly as defined by Microsoft.

Step-by-Step: Heft-Based SPFx Build Flow

Step 1: Create an SPFx Project

When you create a new SPFx project (v1.20+), it is Heft-based by default .

yo @microsoft/sharepoint 

No 'gulp.js' is created.

Step 2: Heft-Based Project Structure

Key configuration files:

config/
  heft.json
  rig.json
  serve.json
src/
package.json

Step 3: Rig Configuration

SPFx loads its build pipeline from the rig.

{
  "rigPackageName": "@microsoft/spfx-rig",
  "rigProfile": "default"
}

This tells Heft to use Microsoft’s predefined SPFx build rules.

Step 4: Heft Loads the SPFx Rig

Internally:

  1. Heft starts

  2. Reads rig.json

  3. Loads @microsoft/spfx-rig

  4. Registers all SPFx build plugins (TS, Webpack, SCSS, localization, packaging)

Step 5: Run Build Commands

All commands are CLI-based:

npm run build
npm run bundle -- --production
npm run package-solution -- --production

Heft orchestrates everything—no custom tasks required.

Step 6: TypeScript Compilation

Step 7: Webpack Bundling

Step 8: SCSS and Localization

Step 9: Local Development

npm run serve 

Step 10: Package and Deploy

npm run package-solution -- --production 

Output

sharepoint/solution/*.sppkg 

Upload the package to the App Catalog for deployment.

Architecture Diagram

Screenshot 2025-12-12 133239

Heft & Rig (New SPFx Architecture)

heft.json / rig.json- Heft (CLI + Config-based engine)- Loads SPFx Rig (predefined build system)- TypeScript/Webpack/SCSS/Manifest/Packaging

Developer Experience Before and After

Before (Gulp)

Now (Heft + Rig)

Conclusion

Heft is a modern, CLI-based build orchestrator that offers a clean, standardized way of building SPFx projects. It is not GUI-based i.e all operations run through command-line tools and configuration files. Rigs act as pre-built templates that define how Heft should run.

Together, Heft + Rig replace Gulp and provide a stable, future-proof foundation for SharePoint Framework development.