chore: add esbuild-plugin-preserve-directives #193
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Description: Add esbuild-plugin-preserve-directives to README
This PR adds the
esbuild-plugin-preserve-directives
plugin to the "Other plugins" section of the README.md file.Plugin Description
esbuild-plugin-preserve-directives: A plugin that preserves directives like 'use client' in specified chunks, maintaining them where originally placed, unlike esbuild's banner API which adds to all files.
Why This Plugin is Important
Problem Solved: By default, esbuild removes directives like 'use client' when building chunks. This plugin solves that issue by preserving these crucial directives.
Improvement over Banner API: While esbuild's banner API can add directives, it does so for all files indiscriminately. This plugin offers a more targeted approach.
Efficiency: It allows developers to maintain directives only where necessary, avoiding the overhead of adding them to every file.
Framework Compatibility: Ensures compatibility with frameworks like Next.js that rely on these directives for proper functionality.
Changes Made
Checklist
This addition will help esbuild users more effectively manage framework-specific directives in their projects, improving build output quality and maintaining crucial runtime behaviors.
Thanks!