From 33326ee745ae2f1f4f2422e19c18362f86ca72eb Mon Sep 17 00:00:00 2001
From: hardenzheng <18740459807@163.com>
Date: Sun, 29 Sep 2024 20:38:44 +0800
Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DTaro=E4=BD=BF?=
=?UTF-8?q?=E7=94=A8=E5=8E=9F=E7=94=9F=E9=A1=B5=E9=9D=A2=EF=BC=88=E5=BE=AE?=
=?UTF-8?q?=E4=BF=A1=E5=B0=8F=E7=A8=8B=E5=BA=8F=EF=BC=89=E6=97=B6,=20.wxml?=
=?UTF-8?q?=E4=B8=AD=E7=9A=84src=3D{{url}},=E6=9D=A5=E8=87=AAdata=E7=9A=84?=
=?UTF-8?q?url=E8=A2=AB=E5=BC=82=E5=B8=B8=E8=A7=A3=E6=9E=90=E7=9A=84bug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/loaders/miniTemplateLoader.ts | 3 +++
packages/taro-webpack5-runner/src/utils/index.ts | 9 +++++++++
2 files changed, 12 insertions(+)
diff --git a/packages/taro-webpack5-runner/src/loaders/miniTemplateLoader.ts b/packages/taro-webpack5-runner/src/loaders/miniTemplateLoader.ts
index 0a72f102b73f..0312ced4816d 100644
--- a/packages/taro-webpack5-runner/src/loaders/miniTemplateLoader.ts
+++ b/packages/taro-webpack5-runner/src/loaders/miniTemplateLoader.ts
@@ -1,5 +1,6 @@
import { isUrlRequest, urlToRequest } from 'loader-utils'
import sax from 'sax'
+import { isSpecialFormat } from '../utils/index'
export default function miniTemplateLoader (source) {
this.cacheable && this.cacheable()
@@ -20,6 +21,8 @@ export default function miniTemplateLoader (source) {
parser.onattribute = ({ name, value }) => {
if (value && (name === 'src' || name === 'from') && isUrlRequest(value)) {
+ if (isSpecialFormat(name, value)) return
+
const request = urlToRequest(value)
requests.add(request)
}
diff --git a/packages/taro-webpack5-runner/src/utils/index.ts b/packages/taro-webpack5-runner/src/utils/index.ts
index 017cb0ccc6ce..0af62eecf9d0 100644
--- a/packages/taro-webpack5-runner/src/utils/index.ts
+++ b/packages/taro-webpack5-runner/src/utils/index.ts
@@ -45,3 +45,12 @@ export const formatOpenHost = (host?: string) => {
export function parsePublicPath (publicPath = '/') {
return ['', 'auto'].includes(publicPath) ? publicPath : addTrailingSlash(publicPath)
}
+
+export function isSpecialFormat(key: string, value: string) {
+ if (key === 'src' && /{{\s*\w+\s*}}/.test(value)) {
+ // in .wxml, the value url in should not be requested, it is a state value in page data
+ return true
+ }
+
+ return false
+}
From 6dd47cbc1989f655c93b380633c7c956a254e5a0 Mon Sep 17 00:00:00 2001
From: zhengyanan18
Date: Wed, 16 Oct 2024 17:44:56 +0800
Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dlint=E6=8A=A5?=
=?UTF-8?q?=E9=94=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
packages/taro-webpack5-runner/src/loaders/miniTemplateLoader.ts | 1 +
1 file changed, 1 insertion(+)
diff --git a/packages/taro-webpack5-runner/src/loaders/miniTemplateLoader.ts b/packages/taro-webpack5-runner/src/loaders/miniTemplateLoader.ts
index 0312ced4816d..57bd5d29816e 100644
--- a/packages/taro-webpack5-runner/src/loaders/miniTemplateLoader.ts
+++ b/packages/taro-webpack5-runner/src/loaders/miniTemplateLoader.ts
@@ -1,5 +1,6 @@
import { isUrlRequest, urlToRequest } from 'loader-utils'
import sax from 'sax'
+
import { isSpecialFormat } from '../utils/index'
export default function miniTemplateLoader (source) {