Skip to content

chore(plugin): raise build target from es2017 to Vite's baseline default - #107

Merged
awdr74100 merged 1 commit into
mainfrom
chore/plugin-baseline-target
Jul 26, 2026
Merged

chore(plugin): raise build target from es2017 to Vite's baseline default#107
awdr74100 merged 1 commit into
mainfrom
chore/plugin-baseline-target

Conversation

@awdr74100

Copy link
Copy Markdown
Owner

Summary

  • Both vite.config.ts (UI panel) and vite.config.main.ts (sandbox) were pinned to target: 'es2017' since the initial commit, uncommented, with no compatibility rationale on record.
  • es2017 predates ES2018 object rest/spread, which @lucide/vue's Icon component 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).
  • The codebase already calls Array.prototype.toSorted/toReversed (ES2023 built-ins — unrelated to target, 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.
  • Switched both to Vite 8's own '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.
  • Side benefit: smaller output — dist/index.html 258KB → 236.79KB, dist/code.js 203KB → 195.69KB.

Test plan

  • pnpm typecheck && pnpm lint && pnpm format:check && pnpm knip && pnpm build && pnpm test — all pass (172 files / 1212 tests)
  • Verified no babel string remains in either build output

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.
@awdr74100
awdr74100 merged commit aa2c93e into main Jul 26, 2026
2 checks passed
@awdr74100
awdr74100 deleted the chore/plugin-baseline-target branch July 26, 2026 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant