Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add opus filetype to assets & mime types #12526

Merged
merged 1 commit into from Mar 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/vite/client.d.ts
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
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
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