Skip to content

Commit

Permalink
feat: add opus filetype to assets & mime types (#12526)
Browse files Browse the repository at this point in the history
  • Loading branch information
mia-riezebos authored Mar 22, 2023
1 parent 1030049 commit 63524ba
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/vite/client.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ declare module '*.aac' {
export default src
}

declare module '*.opus' {
const src: string
export default src
}

// fonts
declare module '*.woff' {
const src: string
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 @@ -115,6 +115,7 @@ export const KNOWN_ASSET_TYPES = [
'wav',
'flac',
'aac',
'opus',

// fonts
'woff2?',
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 @@ -47,6 +47,8 @@ export function registerCustomMime(): void {
mrmime.mimes['flac'] = 'audio/flac'
// mrmime and mime-db is not released yet: https://github.com/jshttp/mime-db/commit/c9242a9b7d4bb25d7a0c9244adec74aeef08d8a1
mrmime.mimes['aac'] = 'audio/aac'
// https://wiki.xiph.org/MIME_Types_and_File_Extensions#.opus_-_audio/ogg
mrmime.mimes['opus'] = 'audio/ogg'
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
mrmime.mimes['eot'] = 'application/vnd.ms-fontobject'
}
Expand Down

0 comments on commit 63524ba

Please sign in to comment.