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

fix(easycom): case-sensitive

上级 77c6a7fa
...@@ -122,7 +122,7 @@ function isValidPage (page, root = '') { ...@@ -122,7 +122,7 @@ function isValidPage (page, root = '') {
process.env.UNI_PLATFORM === 'app-plus' && process.env.UNI_PLATFORM === 'app-plus' &&
page.style page.style
) { ) {
const subNVues = page.style.subNVues || (page.style['app-plus'] && page.style['app-plus']['subNVues']) const subNVues = page.style.subNVues || (page.style['app-plus'] && page.style['app-plus'].subNVues)
if (Array.isArray(subNVues)) { if (Array.isArray(subNVues)) {
subNVues.forEach(subNVue => { subNVues.forEach(subNVue => {
let subNVuePath = subNVue.path let subNVuePath = subNVue.path
...@@ -155,8 +155,8 @@ function isValidPage (page, root = '') { ...@@ -155,8 +155,8 @@ function isValidPage (page, root = '') {
return true return true
} else { } else {
uniNVuePages.push({ uniNVuePages.push({
'path': pagePath + '.html', path: pagePath + '.html',
'style': page.style || {} style: page.style || {}
}) })
return false return false
} }
...@@ -342,9 +342,11 @@ function getAutoComponentsByDir (componentsPath, absolute = false) { ...@@ -342,9 +342,11 @@ function getAutoComponentsByDir (componentsPath, absolute = false) {
fs.readdirSync(componentsPath).forEach(name => { fs.readdirSync(componentsPath).forEach(name => {
const folder = path.resolve(componentsPath, name) const folder = path.resolve(componentsPath, name)
const importDir = absolute ? normalizePath(folder) : `@/components/${name}` const importDir = absolute ? normalizePath(folder) : `@/components/${name}`
if (fs.existsSync(path.resolve(folder, name + '.vue'))) { // 读取文件夹文件列表,比对文件名(fs.existsSync在大小写不敏感的系统会匹配不准确)
const files = fs.readdirSync(folder)
if (files.includes(name + '.vue')) {
components[`^${name}$`] = `${importDir}/${name}.vue` components[`^${name}$`] = `${importDir}/${name}.vue`
} else if (fs.existsSync(path.resolve(folder, name + '.nvue'))) { } else if (files.includes(name + '.nvue')) {
components[`^${name}$`] = `${importDir}/${name}.nvue` components[`^${name}$`] = `${importDir}/${name}.nvue`
} }
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册