From 96084d6e752c03332d101a50bce161a8e3f311cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Mon, 30 Sep 2024 17:57:36 +0900 Subject: [PATCH] fix(data-uri): only match ids starting with `data:` (#18241) --- packages/vite/src/node/plugins/dataUri.ts | 2 +- playground/data-uri/index.html | 4 ++++ playground/data-uri/vite.config.js | 20 ++++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 playground/data-uri/vite.config.js diff --git a/packages/vite/src/node/plugins/dataUri.ts b/packages/vite/src/node/plugins/dataUri.ts index c2a71a88c..9560700a5 100644 --- a/packages/vite/src/node/plugins/dataUri.ts +++ b/packages/vite/src/node/plugins/dataUri.ts @@ -22,7 +22,7 @@ export function dataURIPlugin(): Plugin { }, resolveId(id) { - if (!dataUriRE.test(id)) { + if (!id.trimStart().startsWith('data:')) { return } diff --git a/playground/data-uri/index.html b/playground/data-uri/index.html index 597c3a204..3794f74db 100644 --- a/playground/data-uri/index.html +++ b/playground/data-uri/index.html @@ -1,5 +1,6 @@
+