Make esbuild
an optional peer dependency
#1232
Merged
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.
Prior art and discussions: #1018, #1171
esbuild
is now a peer dependency inesbuild-plugin
andesbuild-plugin-next
.Why make it a peer dependency? Because our script to bundle types bundles the
Plugin
type fromesbuild
into the output, which can cause a type error when consumers try to use it.It's marked as optional, so it won't crash on install when consumers don't have
esbuild
in their dependencies.I believe this is a better solution than both #1018 and #1171.
#1171 is too intrusive and adds
esbuild
everywhere, and consumers have to include it in their dependencies.Relevant xkcd: https://xkcd.com/927/
Before
https://unpkg.com/browse/@vanilla-extract/[email protected]/dist/vanilla-extract-esbuild-plugin.cjs.d.ts (
Plugin
type is inlined)After