提交 c3dbde6a 编写于 作者: fxy060608's avatar fxy060608

fix(cli): compatible with windows (normalize path)

上级 11241069
const path = require('path')
const isWin = /^win/.test(process.platform)
const normalizePath = path => (isWin ? path.replace(/\\/g, '/') : path)
const defaultOptions = {
limit: -1,
fallback: {
......@@ -10,12 +14,12 @@ const defaultOptions = {
process.env.UNI_PLATFORM === 'app-plus' &&
process.env.UNI_USING_V3
) { // app-plus v3 下路径不能以/开头
return path.relative(process.env.UNI_INPUT_DIR, resourcePath)
return normalizePath(path.relative(process.env.UNI_INPUT_DIR, resourcePath))
}
return '/' + path.relative(process.env.UNI_INPUT_DIR, resourcePath)
return '/' + normalizePath(path.relative(process.env.UNI_INPUT_DIR, resourcePath))
},
outputPath (url, resourcePath, context) {
return path.relative(process.env.UNI_INPUT_DIR, resourcePath)
return normalizePath(path.relative(process.env.UNI_INPUT_DIR, resourcePath))
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册