From 5ec9eedc80bbf39a33b498198ba07ed1bd9cacc7 Mon Sep 17 00:00:00 2001 From: Rantetsu Inori <56647156+otomad@users.noreply.github.com> Date: Tue, 19 Nov 2024 14:18:07 +0800 Subject: [PATCH] feat: add support for .cur type (#18680) Co-authored-by: sapphi-red <49056869+sapphi-red@users.noreply.github.com> --- packages/vite/client.d.ts | 4 ++++ packages/vite/src/node/constants.ts | 1 + packages/vite/src/node/plugins/asset.ts | 2 ++ 3 files changed, 7 insertions(+) diff --git a/packages/vite/client.d.ts b/packages/vite/client.d.ts index d9ef59cb9..16e2b167d 100644 --- a/packages/vite/client.d.ts +++ b/packages/vite/client.d.ts @@ -102,6 +102,10 @@ declare module '*.avif' { const src: string export default src } +declare module '*.cur' { + const src: string + export default src +} // media declare module '*.mp4' { diff --git a/packages/vite/src/node/constants.ts b/packages/vite/src/node/constants.ts index 596ffcdcd..453a1bb5b 100644 --- a/packages/vite/src/node/constants.ts +++ b/packages/vite/src/node/constants.ts @@ -132,6 +132,7 @@ export const KNOWN_ASSET_TYPES = [ 'ico', 'webp', 'avif', + 'cur', // media 'mp4', diff --git a/packages/vite/src/node/plugins/asset.ts b/packages/vite/src/node/plugins/asset.ts index fb9122b5b..d6f84ebc4 100644 --- a/packages/vite/src/node/plugins/asset.ts +++ b/packages/vite/src/node/plugins/asset.ts @@ -51,6 +51,8 @@ export function registerCustomMime(): void { // 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://mimesniff.spec.whatwg.org/#matching-an-image-type-pattern + mrmime.mimes['cur'] = 'image/x-icon' // https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Containers#flac mrmime.mimes['flac'] = 'audio/flac' // https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types