File tree 4 files changed +8
-1
lines changed
packages/vite/src/node/plugins
4 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -286,7 +286,7 @@ export function buildHtmlPlugin(config: ResolvedConfig): Plugin {
286
286
config . plugins ,
287
287
)
288
288
preHooks . unshift ( preImportMapHook ( config ) )
289
- normalHooks . unshift ( htmlEnvHook ( config ) )
289
+ preHooks . push ( htmlEnvHook ( config ) )
290
290
postHooks . push ( postImportMapHook ( ) )
291
291
const processedHtml = new Map < string , string > ( )
292
292
const isExcludedUrl = ( url : string ) =>
Original file line number Diff line number Diff line change 1
1
VITE_FOO = bar
2
+ VITE_FAVICON_URL = /sprite.svg
Original file line number Diff line number Diff line change @@ -273,6 +273,11 @@ describe('env', () => {
273
273
expect ( await page . textContent ( '.env-bar' ) ) . toBeTruthy ( )
274
274
expect ( await page . textContent ( '.env-prod' ) ) . toBe ( isBuild + '' )
275
275
expect ( await page . textContent ( '.env-dev' ) ) . toBe ( isServe + '' )
276
+
277
+ const iconLink = await page . $ ( 'link[rel=icon]' )
278
+ expect ( await iconLink . getAttribute ( 'href' ) ) . toBe (
279
+ `${ isBuild ? './' : '/' } sprite.svg` ,
280
+ )
276
281
} )
277
282
} )
278
283
Original file line number Diff line number Diff line change 3
3
< p class ="env-%VITE_FOO% "> class name should be env-bar</ p >
4
4
< p class ="env-prod "> %PROD%</ p >
5
5
< p class ="env-dev "> %DEV%</ p >
6
+ < link rel ="icon " href ="%VITE_FAVICON_URL% " />
You can’t perform that action at this time.
0 commit comments