mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #53] [MERGED] fix(google-fonts): use closure variables instead of this for plugin sstate #271
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#271
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/53
Author: @MehediH
Created: 2/25/2026
Status: ✅ Merged
Merged: 3/28/2026
Merged by: @southpolesteve
Base:
main← Head:fix/google-fonts-this-binding📝 Commits (8)
1619e56fix(google-fonts): use closure variables instead of this for plugin statefe0b5f1fix(google-fonts): fix indentation of plugin object properties inside IIFE return8f5bec9fix: update tests to use closure-compatible plugin initialization3bf18a3Merge branch 'origin/main' into fix/google-fonts-this-bindingba6c14efix(google-fonts): apply closure-variable fix on top of main's refactored plugina054fbbfmt46cba58fix tests: replace plugin._isBuild direct access with initPlugin() helper41ddc05fix: silence no-unused-vars lint warnings in font-google tests📊 Changes
2 files changed (+414 additions, -370 deletions)
View changed files
📝
packages/vinext/src/index.ts(+225 -223)📝
tests/font-google.test.ts(+189 -147)📄 Description
Vite does not bind
thisto the plugin object when calling hooks — it extracts the hook function and calls it directly. This meansthis._isBuildetc. inconfigResolvedandtransform.handlerrefers toundefinedin strict mode, crashing the dev server with:Fix: wrap the plugin in an IIFE and hold state in closure variables instead of as properties on the plugin object.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.