Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: scriptSource posix issue fail build command #16222

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/taro-vite-runner/src/h5/config.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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(/<script><%= htmlWebpackPlugin.options.script %><\/script>/, htmlScript)
},
Expand Down
4 changes: 2 additions & 2 deletions packages/taro-vite-runner/src/h5/entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ export default function (viteCompilerContext: ViteH5CompilerContext): PluginOpti
}, '')

const getTabbarIconPath = (iconPath) => {
return isProd
return normalizePath(isProd
? path.join('/', taroConfig.staticDirectory as string, 'images', path.basename(iconPath))
: iconPath.replace(/^./, '')
: iconPath.replace(/^./, ''))
}

const emitTabbarIcon = async (sourceDir, iconPath) => {
Expand Down