Skip to content

Commit

Permalink
feat: platforms 目录支持 app、web 目录
Browse files Browse the repository at this point in the history
  • Loading branch information
fxy060608 committed Jan 3, 2024
1 parent 44c28dd commit addb59c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/uni-cli-shared/lib/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,15 @@ function isValidPage (page, root = '') {
let pagePath = page.path

if (pagePath.indexOf('platforms') === 0) { // 平台相关
if (pagePath.indexOf('platforms/' + process.env.UNI_PLATFORM) === -1) { // 非本平台
if (process.env.UNI_PLATFORM === 'h5' || process.env.UNI_PLATFORM === 'web') {
if (!(pagePath.indexOf('platforms/h5/') === 0 || pagePath.indexOf('platforms/web/') === 0)) {
return false
}
} else if (process.env.UNI_PLATFORM === 'app-plus' || process.env.UNI_PLATFORM === 'app') {
if (!(pagePath.indexOf('platforms/app-plus/') === 0 || pagePath.indexOf('platforms/app/') === 0)) {
return false
}
} else if (pagePath.indexOf('platforms/' + process.env.UNI_PLATFORM) === -1) { // 非本平台
return false
}
}
Expand Down Expand Up @@ -578,4 +586,4 @@ module.exports = {
getGlobalUsingComponentsCode,
parseUsingAutoImportComponents,
generateGlobalUsingComponentsCode
}
}

0 comments on commit addb59c

Please sign in to comment.