diff --git a/packages/vite/src/node/constants.ts b/packages/vite/src/node/constants.ts index b251eddb6f03c9..596ffcdcdd0ebf 100644 --- a/packages/vite/src/node/constants.ts +++ b/packages/vite/src/node/constants.ts @@ -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', diff --git a/packages/vite/src/node/plugins/asset.ts b/packages/vite/src/node/plugins/asset.ts index 335ed6fbbb7701..fb9122b5b18b76 100644 --- a/packages/vite/src/node/plugins/asset.ts +++ b/packages/vite/src/node/plugins/asset.ts @@ -48,6 +48,8 @@ export const cssEntriesMap = new WeakMap>() // 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'