Skip to content

Commit

Permalink
fix(css): temporary add ?. after this.getModuleInfo in `vite:css-…
Browse files Browse the repository at this point in the history
…post` (#19478)
  • Loading branch information
sapphi-red authored Feb 21, 2025
1 parent d686252 commit 12b0b8a
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions packages/vite/src/node/plugins/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -645,11 +645,15 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {

// build CSS handling ----------------------------------------------------

const cssScopeTo = (
this.getModuleInfo(id)?.meta?.vite as
| CustomPluginOptionsVite
| undefined
)?.cssScopeTo
const cssScopeTo =
// NOTE: `this.getModuleInfo` can be undefined when the plugin is called directly
// adding `?.` temporary to avoid unocss from breaking
// TODO: remove `?.` after `this.getModuleInfo` in Vite 7
(
this.getModuleInfo?.(id)?.meta?.vite as
| CustomPluginOptionsVite
| undefined
)?.cssScopeTo

// record css
if (!inlined) {
Expand Down

0 comments on commit 12b0b8a

Please sign in to comment.