Skip to content

Commit

Permalink
feat: add support for .jxl (#18855)
Browse files Browse the repository at this point in the history
Co-authored-by: 翠 / green <[email protected]>
  • Loading branch information
yuxi-ovo and sapphi-red authored Jan 23, 2025
1 parent c9a4b7a commit 57b397c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/vite/client.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ declare module '*.cur' {
const src: string
export default src
}
declare module '*.jxl' {
const src: string
export default src
}

// media
declare module '*.mp4' {
Expand Down
1 change: 1 addition & 0 deletions packages/vite/src/node/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ export const KNOWN_ASSET_TYPES = [
'webp',
'avif',
'cur',
'jxl',

// media
'mp4',
Expand Down
2 changes: 2 additions & 0 deletions packages/vite/src/node/plugins/asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ export function registerCustomMime(): void {
mrmime.mimes['flac'] = 'audio/flac'
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
mrmime.mimes['eot'] = 'application/vnd.ms-fontobject'
// https://github.com/lukeed/mrmime/issues/10
mrmime.mimes['jxl'] = 'image/jxl'
}

export function renderAssetUrlInJS(
Expand Down

0 comments on commit 57b397c

Please sign in to comment.