Skip to content

Commit 899097d

Browse files
committed
fix: win 下路径判断有误的问题
1 parent 86e1fb1 commit 899097d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/mp-compiler/util.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ function getCompNameAndSrc (context, file) {
3131
function getNameByFile (dir) {
3232
// const arr = dir.match(/[pages?/components?]\/(.*?)(\/)/)
3333
const arr = dir.match(/pages\/(.*?)\//)
34-
if (arr && arr[1]) {
34+
// 兼容 win 下的路径格式不统一的问题
35+
if (path.resolve(arr) && path.resolve(arr[1])) {
3536
return arr[1]
3637
}
3738
return path.parse(dir).name

0 commit comments

Comments
 (0)