Proposal: Official @rsbuild/plugin-block-imports - A General Utility to Control/Filter Imports and File Resolution #6763
Closed
malekabdelkader
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
|
Thanks for the suggestion and for sharing this plugin. It addresses a real problem in practice. Given the limited maintenance capacity of the core team, I prefer to keep this plugin maintained in the community rather than moving it into the official Rsbuild plugins. I have added it to awesome-rstack so that more people who need it can easily find it. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
1. 🛑 The Core Problem: Next.js Artifact Leakage
I've experienced a critical, repeatable bug across multiple companies using Module Federation and R2WC with Rsbuild/Rspack.
When components originating from a Next.js environment are shared, unresolvable imports like
next/link,next/image, etc., leak into the consumer bundle. This causes hard-to-debug runtime errors in the final application, stalling micro-frontend adoption.2. ✅ The Solution: Import Filtering Utility
I have created
rsbuild-plugin-block-importsto address this with a clean, declarative API.This plugin is a general utility that allows users to define modules or regex patterns that must be detected , Logged and forced a build error (Optional) , acting as an essential architectural guardrail.
Key API Example
The plugin immediately solves the interoperability issue:
3. ➡️ Request for Official Adoption
Given that this resolves a critical, recurring pain point in large-scale component sharing, I believe it should be an official Rsbuild utility.
https://github.com/malekabdelkader/rsbuild-plugin-block-imports
https://www.npmjs.com/package/rsbuild-plugin-block-imports
@rsbuild/plugin-block-imports? If so, please advise on the correct repository for a Pull Request.Beta Was this translation helpful? Give feedback.
All reactions