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

chore: add some comments about mimes #18705

Merged
merged 1 commit into from
Nov 19, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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