Skip to content

Commit

Permalink
fix: inherit css preload data when chunks are bundled up
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Mar 20, 2024
1 parent 4793b4c commit c11b257
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/plugins/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,15 @@ export const FontFamilyInjectionPlugin = (options: FontFamilyInjectionPluginOpti
...resolveMinifyCssEsbuildOptions(config.esbuild)
}
},
renderChunk (code, chunk) {
if (chunk.facadeModuleId) {
for (const file of chunk.moduleIds) {
if (options.fontMap.has(file)) {
options.fontMap.set(chunk.facadeModuleId, options.fontMap.get(file)!)
}
}
}
},
async generateBundle (_outputOptions, bundle) {
for (const key in bundle) {
const chunk = bundle[key]!
Expand Down

0 comments on commit c11b257

Please sign in to comment.