Skip to content

Commit

Permalink
chore: add some comments about mimes (#18705)
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red authored Nov 19, 2024
1 parent 7b6c59e commit f07e9b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/vite/src/node/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ export const CLIENT_DIR = path.dirname(CLIENT_ENTRY)
// add a mime type to the `registerCustomMime` in
// `packages/vite/src/node/plugin/assets.ts` if mime type cannot be
// looked up by mrmime.
// You can check if the mime type can be looked up by mrmime by running
// `node --print "require('mrmime').lookup('foo.png')"`
export const KNOWN_ASSET_TYPES = [
// images
'apng',
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 @@ -48,6 +48,8 @@ export const cssEntriesMap = new WeakMap<Environment, Set<string>>()
// add own dictionary entry by directly assigning mrmime
export function registerCustomMime(): void {
// https://github.com/lukeed/mrmime/issues/3
// instead of `image/vnd.microsoft.icon` which is registered on IANA Media Types DB
// image/x-icon should be used instead for better compatibility (https://github.com/h5bp/html5-boilerplate/issues/219)
mrmime.mimes['ico'] = 'image/x-icon'
// https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Containers#flac
mrmime.mimes['flac'] = 'audio/flac'
Expand Down

0 comments on commit f07e9b9

Please sign in to comment.