esbuild-plugin-rdi is an ESBuild plugin designed to optimize JavaScript bundles by identifying and removing redundant `require` statements during the minification phase. This process helps to reduce the final bundle size, improving application load times and overall performance. The package is currently at version `0.0.0`, indicating an initial public release or very early development stage. As such, its API surface and internal behavior might be subject to rapid changes, and a formal release cadence is not yet established. Its primary differentiator lies in its targeted approach to deduplicating `require` calls, which can be particularly beneficial for projects that compile to or still rely on CommonJS modules, or when integrating with frameworks like React (versions 18 and 19) and Next.js (versions 14 and 15), especially in scenarios involving React Server Components where such optimizations are crucial. The plugin is intended for use within an `esbuild` build pipeline or through tools like `tsup` that leverage `esbuild`.
npm install esbuild-plugin-rdiVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to integrate `esbuild-plugin-rdi` into an `esbuild` configuration. It sets up a dummy project with duplicate `require` statements, runs `esbuild` with the plugin, and then outputs the (truncated) minified bundle to show its effect on CommonJS imports.
Exercise caution when using in production. Pin to exact versions and consult the GitHub repository for any breaking changes or updated documentation before upgrading.
Ensure your project or the specific parts you want to optimize are using CommonJS `require` syntax for the plugin to be effective. For pure ESM projects, `esbuild`'s default optimizations are usually sufficient.
Thoroughly test the plugin with your exact `esbuild` setup and versions. Monitor bundle size changes and review the output to ensure it performs as expected. Report any unexpected behavior to the maintainers.
Run `npm install esbuild-plugin-rdi` or `pnpm add esbuild-plugin-rdi`. If using TypeScript, ensure your `tsconfig.json` has appropriate `moduleResolution` settings (e.g., `NodeNext` or `Bundler`).
Ensure you are calling `rdiPlugin()` as a function to get the plugin object: `plugins: [rdiPlugin()]`. Do not pass `rdiPlugin` directly without invoking it.
No dependency data recorded yet.