From 7206e0c7f668b0d6dfc6136d868deb13c3199ce0 Mon Sep 17 00:00:00 2001 From: TKSun <1037305420@qq.com> Date: Thu, 1 Aug 2024 20:25:19 +0800 Subject: [PATCH 1/2] fix: scriptSource posix issue fail build command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复 vite h5 dev & build 路径未转 posix 导致的异常 --- packages/taro-vite-runner/src/h5/config.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/taro-vite-runner/src/h5/config.ts b/packages/taro-vite-runner/src/h5/config.ts index d0e8e892f0f5..d4590edebe12 100644 --- a/packages/taro-vite-runner/src/h5/config.ts +++ b/packages/taro-vite-runner/src/h5/config.ts @@ -1,6 +1,6 @@ import path from 'node:path' -import { defaultMainFields, PLATFORMS, recursiveMerge, REG_NODE_MODULES_DIR } from '@tarojs/helper' +import { defaultMainFields, PLATFORMS, recursiveMerge, REG_NODE_MODULES_DIR, normalizePath } from '@tarojs/helper' import { getSassLoaderOption } from '@tarojs/runner-utils' import { isBoolean, isNumber, isObject, isString, PLATFORM_TYPE } from '@tarojs/shared' import { get } from 'lodash' @@ -198,7 +198,7 @@ export default function (viteCompilerContext: ViteH5CompilerContext): PluginOpti // mpa 模式关于 html 的处理已经解藕到 mpa.ts if (isMultiRouterMode) return html const { configPath } = app - const scriptSource = configPath.replace(sourceDir, '') + const scriptSource = normalizePath(configPath.replace(sourceDir, '')) const htmlScript = getHtmlScript(scriptSource, pxtransformOption) return html.replace(/