Skip to content
Closed
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
17 changes: 13 additions & 4 deletions packages/vite/src/node/plugins/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -652,10 +652,19 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {

async renderChunk(code, chunk, opts, meta) {
let chunkCSS = ''
const renderedModules = Object.fromEntries(
Object.values(meta.chunks).flatMap((chunk) =>
Object.entries(chunk.modules),
),
const renderedModules = new Proxy(
{} as Record<string, RenderedModule | undefined>,
{
get(_target, p) {
for (const name in meta.chunks) {
const modules = meta.chunks[name].modules
const module = modules[p as string]
if (module) {
return module
}
}
},
},
)
// the chunk is empty if it's a dynamic entry chunk that only contains a CSS import
const isJsChunkEmpty = code === '' && !chunk.isEntry
Expand Down
Loading