Skip to content

Conversation

hi-ogawa
Copy link
Collaborator

problem

When using "shared plugin mode" during build https://vite.dev/guide/api-environment-plugins.html#shared-plugins-during-build, plugin's assetContext.renderedFontURLs state is shared between all environment builds and it causes emitFile during generateBundle to doubly/triply output font assets on unrelated environments. For example, this is the case on @vitejs/plugin-rsc based app and it currently causes css and font processed on rsc environment to cause other environments to also write font files.

solution

This PR moves emitFile from generateBundle to assetContext.callback, which is called only when transformCss found a relevant assets and this avoids generating fonts in an unrelated environment.

Copy link

netlify bot commented Sep 27, 2025

Deploy Preview for fontless failed.

Name Link
🔨 Latest commit 03610f9
🔍 Latest deploy log https://app.netlify.com/projects/fontless/deploys/68db84ac03091c000920cbc3

Copy link

pkg-pr-new bot commented Sep 30, 2025

Open in StackBlitz

npm i https://pkg.pr.new/fontaine@653
npm i https://pkg.pr.new/fontless@653

commit: 03610f9

Copy link

codecov bot commented Sep 30, 2025

Codecov Report

❌ Patch coverage is 0% with 36 lines in your changes missing coverage. Please review.
✅ Project coverage is 52.90%. Comparing base (d66809d) to head (03610f9).

Files with missing lines Patch % Lines
packages/fontless/src/vite.ts 0.00% 29 Missing ⚠️
packages/fontless/src/assets.ts 0.00% 4 Missing ⚠️
packages/fontless/src/resolve.ts 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #653      +/-   ##
==========================================
- Coverage   53.40%   52.90%   -0.50%     
==========================================
  Files          11       11              
  Lines         734      739       +5     
  Branches       93       93              
==========================================
- Hits          392      391       -1     
- Misses        342      348       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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