File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
packages/hap-packager/src/router Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import moment from 'moment'
1010
1111import {
1212 colorconsole ,
13+ readJson ,
1314 relateCwd ,
1415 globalConfig ,
1516 recordClient ,
@@ -63,7 +64,26 @@ async function bundle(context, next) {
6364 const projectName = projectInfo . projectName
6465 const projectVersion = projectInfo . projectVersion
6566 const platformVersion = context . request . query . platformVersion
66- if ( platformVersion && platformVersion >= RPKS_SUPPORT_VERSION_FROM ) {
67+ let useAppRpk = false
68+ // 应用模式下
69+ if ( parseInt ( context . request . query . mode || 0 ) === 0 ) {
70+ // 读取 manifest
71+ let manifest
72+ try {
73+ manifest = readJson ( path . join ( projectPath , './src/manifest.json' ) )
74+ } catch ( err ) {
75+ manifest = null
76+ }
77+ // 不存在分包
78+ if ( manifest && manifest . router && ( ! manifest . subpackages || manifest . subpackages . length === 0 ) ) {
79+ // 存在卡片
80+ if ( manifest . router . widgets && Object . keys ( manifest . router . widgets ) . length > 0 ) {
81+ useAppRpk = true
82+ }
83+ }
84+ }
85+
86+ if ( platformVersion && platformVersion >= RPKS_SUPPORT_VERSION_FROM && ! useAppRpk ) {
6787 distFile = getDistFilePath ( projectDist , projectName , projectVersion , 'rpks' )
6888 }
6989 if ( ! distFile ) {
You can’t perform that action at this time.
0 commit comments