Skip to content

Commit f07e9b9

Browse files
authored
chore: add some comments about mimes (#18705)
1 parent 7b6c59e commit f07e9b9

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

packages/vite/src/node/constants.ts

+2
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ export const CLIENT_DIR = path.dirname(CLIENT_ENTRY)
116116
// add a mime type to the `registerCustomMime` in
117117
// `packages/vite/src/node/plugin/assets.ts` if mime type cannot be
118118
// looked up by mrmime.
119+
// You can check if the mime type can be looked up by mrmime by running
120+
// `node --print "require('mrmime').lookup('foo.png')"`
119121
export const KNOWN_ASSET_TYPES = [
120122
// images
121123
'apng',

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

+2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ export const cssEntriesMap = new WeakMap<Environment, Set<string>>()
4848
// add own dictionary entry by directly assigning mrmime
4949
export function registerCustomMime(): void {
5050
// https://github.com/lukeed/mrmime/issues/3
51+
// instead of `image/vnd.microsoft.icon` which is registered on IANA Media Types DB
52+
// image/x-icon should be used instead for better compatibility (https://github.com/h5bp/html5-boilerplate/issues/219)
5153
mrmime.mimes['ico'] = 'image/x-icon'
5254
// https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Containers#flac
5355
mrmime.mimes['flac'] = 'audio/flac'

0 commit comments

Comments
 (0)