chore(plugin): raise build target from es2017 to Vite's baseline default - #107
Merged
Conversation
Both configs were pinned to `es2017` since the project's initial commit, with no comment explaining why — it predates ES2018 object rest/spread, which @lucide/vue's Icon component uses, so esbuild/Rolldown had to synthesize a downlevel shim on every build (visibly, an inlined `"@babel/helpers - typeof"` helper — Rolldown reuses Babel's algorithm for this, not an actual Babel dependency). The codebase already relies on Array.prototype.toSorted/toReversed (ES2023 built-ins, unrelated to `target` — that option only downlevels syntax, never polyfills methods) in both the sandbox and the UI panel, and both call sites are live-verified against real Figma. That already proves the real runtime floor is far newer than es2017, so there's no compatibility reason to keep it. Switch both to Vite 8's own `'baseline-widely-available'` default (chrome111/edge111/firefox114/safari16.4/ios16.4) instead of picking an arbitrary ES-year string — it's Vite's own calibrated answer to "what's safe to assume today," pinned to real engine versions rather than a language-spec year bucket, and stays current as Vite's maintainers revise it. Shrinks output too: dist/index.html 258KB -> 236.79KB, dist/code.js 203KB -> 195.69KB.
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
vite.config.ts(UI panel) andvite.config.main.ts(sandbox) were pinned totarget: 'es2017'since the initial commit, uncommented, with no compatibility rationale on record.es2017predates ES2018 object rest/spread, which@lucide/vue'sIconcomponent uses — every build was silently synthesizing a downlevel shim for it (visible as an inlined"@babel/helpers - typeof"helper; Rolldown reuses Babel's algorithm for this, there's no actual Babel dependency in the project).Array.prototype.toSorted/toReversed(ES2023 built-ins — unrelated totarget, which only downlevels syntax and never polyfills methods) unconditionally in both the sandbox (get-design-context.ts) and the UI panel (diagnostics.ts), and both are live-verified against real Figma. That's concrete proof the real runtime floor is already far newer than es2017.'baseline-widely-available'default (chrome111/edge111/firefox114/safari16.4/ios16.4) rather than picking an arbitrary ES-year string — it's pinned to real engine versions and tracks Vite's own maintained assessment of what's safe to assume.dist/index.html258KB → 236.79KB,dist/code.js203KB → 195.69KB.Test plan
pnpm typecheck && pnpm lint && pnpm format:check && pnpm knip && pnpm build && pnpm test— all pass (172 files / 1212 tests)babelstring remains in either build output