feat: remove esbuild runtime dependency, use Vite's bundled rolldown/esbuild#12
Open
srsholmes wants to merge 1 commit into
Open
feat: remove esbuild runtime dependency, use Vite's bundled rolldown/esbuild#12srsholmes wants to merge 1 commit into
srsholmes wants to merge 1 commit into
Conversation
…esbuild - plugin.ts: use rolldown's transformSync (from Vite 8) for JSX/Flow transform - setup.ts: resolve esbuild through vite's dependencies (no direct dep needed) - Move esbuild from dependencies to devDependencies (only needed for build script) - Consumers get slimmer node_modules since esbuild is no longer installed separately Closes #3 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
wojtekmaj
reviewed
Mar 29, 2026
|
|
||
| const require = createRequire(import.meta.url); | ||
|
|
||
| // Resolve esbuild through vite's dependencies (no direct dependency needed) |
Contributor
There was a problem hiding this comment.
That seems hacky and doesn't provide any benefits that I know of
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Removes
esbuildfrom the plugin's runtimedependencies, reducingnode_modulessize for consumers. Vite 8+ already ships both Rolldown and esbuild — this PR leverages those instead of installing esbuild separately.Changes
plugin.ts: Uses Rolldown'stransformSync(fromrolldown/utils, bundled with Vite 8) for JSX/Flow transformation. Rolldown is lazily loaded viabuildStartto handle ESM dynamic import.setup.ts: Resolves esbuild through Vite's dependency chain (createRequire(require.resolve('vite'))) instead of importing it directly. esbuild is still needed here because the pirates hook requires CJS output (format: 'cjs'), which Rolldown's transform API doesn't support.package.json: Movedesbuildfromdependencies→devDependencies(only used by the build script, not shipped to consumers).Why not full Rolldown?
Rolldown's
transformSyncis a syntax transformer (JSX, TypeScript) — it doesn't do module format conversion. The pirates hook insetup.tsinterceptsrequire()calls and must output CJS, which requires esbuild'sformat: 'cjs'. Since esbuild ships with Vite anyway, resolving it through Vite's deps adds zero extra install weight.Test plan
pnpm build)esbuildis only indevDependencies, notdependenciesFixes #3
🤖 Generated with Claude Code