Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

First Custom Binding

This chapter will guide you through creating your first custom Rspack binding, from initial setup to publishing on npm.

You'll learn to build a complete MyBannerPlugin that adds custom banners to generated JavaScript files, demonstrating the full workflow from Rust implementation to JavaScript integration.

What You'll Build

By the end of this chapter, you'll have:

  • A working Rust plugin that integrates with Rspack's compilation process
  • NAPI bindings that expose your Rust code to JavaScript
  • A complete npm package ready for distribution
  • Understanding of the Rspack plugin architecture

Prerequisites

Chapter Overview

  1. Setup - Configure your development environment
  2. Create a Plugin - Build the MyBannerPlugin from scratch
  3. Release - Publish your plugin to npm with GitHub Actions