Skip to content

Commit 63524ba

Browse files
authored
feat: add opus filetype to assets & mime types (#12526)
1 parent 1030049 commit 63524ba

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

packages/vite/client.d.ts

+5
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,11 @@ declare module '*.aac' {
173173
export default src
174174
}
175175

176+
declare module '*.opus' {
177+
const src: string
178+
export default src
179+
}
180+
176181
// fonts
177182
declare module '*.woff' {
178183
const src: string

packages/vite/src/node/constants.ts

+1
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ export const KNOWN_ASSET_TYPES = [
115115
'wav',
116116
'flac',
117117
'aac',
118+
'opus',
118119

119120
// fonts
120121
'woff2?',

packages/vite/src/node/plugins/asset.ts

+2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ export function registerCustomMime(): void {
4747
mrmime.mimes['flac'] = 'audio/flac'
4848
// mrmime and mime-db is not released yet: https://github.com/jshttp/mime-db/commit/c9242a9b7d4bb25d7a0c9244adec74aeef08d8a1
4949
mrmime.mimes['aac'] = 'audio/aac'
50+
// https://wiki.xiph.org/MIME_Types_and_File_Extensions#.opus_-_audio/ogg
51+
mrmime.mimes['opus'] = 'audio/ogg'
5052
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
5153
mrmime.mimes['eot'] = 'application/vnd.ms-fontobject'
5254
}

0 commit comments

Comments
 (0)