Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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