From 98f9b7ab9f14eba4736182df8651120efc8ded16 Mon Sep 17 00:00:00 2001 From: btea <2356281422@qq.com> Date: Wed, 19 Jun 2024 17:51:01 +0800 Subject: [PATCH] feat: image type add bmp (#5921) --- packages/vite-node/src/constants.ts | 1 + packages/vite-node/src/externalize.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/vite-node/src/constants.ts b/packages/vite-node/src/constants.ts index cfa2152b42a4..b1280202ae9f 100644 --- a/packages/vite-node/src/constants.ts +++ b/packages/vite-node/src/constants.ts @@ -1,6 +1,7 @@ export const KNOWN_ASSET_TYPES = [ // images 'apng', + 'bmp', 'png', 'jpe?g', 'jfif', diff --git a/packages/vite-node/src/externalize.ts b/packages/vite-node/src/externalize.ts index 1a9ad3cd3535..a447d6c94032 100644 --- a/packages/vite-node/src/externalize.ts +++ b/packages/vite-node/src/externalize.ts @@ -2,7 +2,7 @@ import { existsSync, promises as fsp } from 'node:fs' import { dirname, extname, join } from 'pathe' import type { DepsHandlingOptions } from './types' import { findNearestPackageData, isNodeBuiltin, slash } from './utils' -import { KNOWN_ASSET_TYPES } from './constants' +import { KNOWN_ASSET_RE } from './constants' const BUILTIN_EXTENSIONS = new Set(['.mjs', '.cjs', '.node', '.wasm']) @@ -18,7 +18,7 @@ const defaultInline = [ // special Vite query strings /[?&](init|raw|url|inline)\b/, // Vite returns a string for assets imports, even if it's inside "node_modules" - new RegExp(`\\.(${KNOWN_ASSET_TYPES.join('|')})$`), + KNOWN_ASSET_RE, ] const depsExternal = [