Skip to content

Commit

Permalink
fix(cli): 分包字段同时支持 subpackages && subPackages,close #1042
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyadam committed Nov 12, 2018
1 parent 4bb99cd commit 3b7000b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/taro-cli/src/h5.js
Expand Up @@ -69,7 +69,7 @@ const FILE_TYPE = {
NORMAL: 'NORMAL'
}

const isUnderSubPackages = (parentPath) => (parentPath.isObjectProperty() && /subPackages/i.test(parentPath.node.key.name))
const isUnderSubPackages = (parentPath) => (parentPath.isObjectProperty() && /subPackages|subpackages/i.test(parentPath.node.key.name))

function processEntry (code, filePath) {
let ast = wxTransformer({
Expand Down
4 changes: 2 additions & 2 deletions packages/taro-cli/src/weapp.js
Expand Up @@ -1052,7 +1052,7 @@ async function buildPages () {
Util.printLog(Util.pocessTypeEnum.COMPILE, '所有页面')
// 支持分包,解析子包页面
const pages = appConfig.pages || []
const subPackages = appConfig.subPackages
const subPackages = appConfig.subPackages || appConfig.subpackages
if (subPackages && subPackages.length) {
subPackages.forEach(item => {
if (item.pages && item.pages.length) {
Expand Down Expand Up @@ -1804,7 +1804,7 @@ function watchFiles () {
const config = await buildEntry()
// TODO 此处待优化
if ((Util.checksum(JSON.stringify(config.pages)) !== Util.checksum(JSON.stringify(appConfig.pages))) ||
(Util.checksum(JSON.stringify(config.subPackages || {})) !== Util.checksum(JSON.stringify(appConfig.subPackages || {})))) {
(Util.checksum(JSON.stringify(config.subPackages || config.subpackages || {})) !== Util.checksum(JSON.stringify(appConfig.subPackages || appConfig.subpackages || {})))) {
appConfig = config
await buildPages()
}
Expand Down

0 comments on commit 3b7000b

Please sign in to comment.