Skip to content

feat: add loader demo#35

Merged
h-a-n-a merged 2 commits intomainfrom
loader
Aug 13, 2025
Merged

feat: add loader demo#35
h-a-n-a merged 2 commits intomainfrom
loader

Conversation

@h-a-n-a
Copy link
Copy Markdown
Contributor

@h-a-n-a h-a-n-a commented Aug 5, 2025

Summary

This PR adds a demonstration of creating and using a custom loader in the rspack-binding-template. The implementation showcases how to build a Rust-based loader that can process source files during the build pipeline.

Changes

  • New Loader Implementation: Added MyBannerLoader in crates/binding/src/loader.rs that prepends a configurable banner to source code
  • Plugin Integration: Created MyBannerLoaderPlugin to register and configure the loader within the build system
  • Example Usage: Added complete example in examples/use-loader/ demonstrating how to configure and use the custom loader
  • CI Integration: Updated workflow to test the loader example as part of the build process

Features

  • Configurable banner text that gets prepended to processed files
  • Proper error handling and loader context integration
  • TypeScript definitions for the new loader plugin
  • Complete working example with build configuration

Test Plan

  • Loader processes files correctly and adds banner
  • Example builds successfully
  • CI pipeline validates the loader functionality
  • TypeScript definitions are properly exposed

🤖 Generated with Claude Code

Add comprehensive documentation comments following existing style:
- Rust doc comments for MyBannerLoaderPlugin and resolve_loader function
- JSDoc comments for MyBannerLoaderPlugin wrapper in lib/index.js
- Inline comments explaining loader usage in build.js example

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@h-a-n-a h-a-n-a marked this pull request as ready for review August 13, 2025 08:07
@h-a-n-a h-a-n-a merged commit 49f622f into main Aug 13, 2025
34 of 36 checks passed
@h-a-n-a h-a-n-a deleted the loader branch August 13, 2025 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant