Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: nest
importedCss
and importedAssets
under viteMetadata
Although it's more verbose, it makes it easier to avoid collisions with rollup or other bundlers like WMR.
- Loading branch information
1 parent
84217c6
commit c23c5de
Showing
9 changed files
with
49 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import type { Plugin } from '../plugin' | ||
|
||
export interface ChunkMetadata { | ||
importedAssets: Set<string> | ||
importedCss: Set<string> | ||
} | ||
|
||
/** | ||
* Prepares the rendered chunks to contain additional metadata during build. | ||
*/ | ||
export function metadataPlugin(): Plugin { | ||
return { | ||
name: 'vite:build-metadata', | ||
|
||
async renderChunk(_code, chunk) { | ||
chunk.viteMetadata = { | ||
importedAssets: new Set(), | ||
importedCss: new Set() | ||
} | ||
return null | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters