Skip to content
This repository was archived by the owner on Mar 19, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 2 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
8 changes: 8 additions & 0 deletions packages/vite/src/node/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1350,9 +1350,17 @@ function injectChunkMetadata(
chunkMetadataMap.set(key, {
importedAssets: new Set(),
importedCss: new Set(),
// use shared `chunk.modules` object
// to allow mutation on js side plugins
__modules: chunk.modules,
Comment thread
sapphi-red marked this conversation as resolved.
})
}
chunk.viteMetadata = chunkMetadataMap.get(key)
Object.defineProperty(chunk, 'modules', {
get() {
return chunk.viteMetadata!.__modules
},
})
}

function injectEnvironmentInContext<Context extends MinimalPluginContext>(
Expand Down
1 change: 1 addition & 0 deletions packages/vite/types/metadata.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export interface ChunkMetadata {
importedAssets: Set<string>
importedCss: Set<string>
__modules: any
}

declare module 'rolldown' {
Expand Down