File tree Expand file tree Collapse file tree 3 files changed +28
-11
lines changed
fixtures/watch-rebuild-manifest Expand file tree Collapse file tree 3 files changed +28
-11
lines changed Original file line number Diff line number Diff line change @@ -1049,7 +1049,10 @@ test('watch rebuild manifest', async (ctx) => {
1049
1049
client : {
1050
1050
build : {
1051
1051
rollupOptions : {
1052
- input : '/entry.js' ,
1052
+ input : {
1053
+ entry : '/entry.js' ,
1054
+ cssEntry : '/entry.css' ,
1055
+ } ,
1053
1056
} ,
1054
1057
} ,
1055
1058
} ,
@@ -1059,19 +1062,19 @@ test('watch rebuild manifest', async (ctx) => {
1059
1062
} ,
1060
1063
} )
1061
1064
1062
- function getManifestKeys ( output : RollupOutput ) {
1063
- return Object . keys (
1064
- JSON . parse (
1065
- ( output . output . find ( ( o ) => o . fileName === '.vite/manifest.json' ) as any )
1066
- . source ,
1067
- ) ,
1068
- )
1065
+ function getManifest ( output : RollupOutput ) {
1066
+ const { source } = output . output . find (
1067
+ ( o ) => o . fileName === '.vite/manifest.json' ,
1068
+ ) as any
1069
+ return JSON . parse ( source )
1069
1070
}
1070
1071
1071
1072
const result = await builder . build ( builder . environments . client )
1072
- expect ( getManifestKeys ( result as RollupOutput ) ) . toMatchInlineSnapshot ( `
1073
+ expect ( Object . keys ( getManifest ( result as RollupOutput ) ) )
1074
+ . toMatchInlineSnapshot ( `
1073
1075
[
1074
1076
"dep.js",
1077
+ "entry.css",
1075
1078
"entry.js",
1076
1079
]
1077
1080
` )
@@ -1087,11 +1090,18 @@ test('watch rebuild manifest', async (ctx) => {
1087
1090
} )
1088
1091
1089
1092
const result2 = await builder . build ( builder . environments . client )
1090
- expect ( getManifestKeys ( result2 as RollupOutput ) ) . toMatchInlineSnapshot ( `
1093
+ const manifest = getManifest ( result2 as RollupOutput )
1094
+ expect ( Object . keys ( manifest ) ) . toMatchInlineSnapshot ( `
1091
1095
[
1096
+ "entry.css",
1092
1097
"entry.js",
1093
1098
]
1094
1099
` )
1100
+ expect ( manifest [ 'entry.css' ] . names ) . toMatchInlineSnapshot ( `
1101
+ [
1102
+ "cssEntry.css",
1103
+ ]
1104
+ ` )
1095
1105
} )
1096
1106
1097
1107
/**
Original file line number Diff line number Diff line change
1
+ .foo {
2
+ color : red;
3
+ }
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ export interface ManifestChunk {
21
21
assets ?: string [ ]
22
22
isEntry ?: boolean
23
23
name ?: string
24
+ names ?: string [ ]
24
25
isDynamicEntry ?: boolean
25
26
imports ?: string [ ]
26
27
dynamicImports ?: string [ ]
@@ -127,7 +128,10 @@ export function manifestPlugin(): Plugin {
127
128
file : asset . fileName ,
128
129
src,
129
130
}
130
- if ( isEntry ) manifestChunk . isEntry = true
131
+ if ( isEntry ) {
132
+ manifestChunk . isEntry = true
133
+ manifestChunk . names = asset . names
134
+ }
131
135
return manifestChunk
132
136
}
133
137
You can’t perform that action at this time.
0 commit comments