编译 app.json 配置全局usingComponents

This commit is contained in:
Wang Kejun 2022-05-09 15:14:48 +08:00
parent 213e5c78ac
commit dd22b3bd9d
1 changed files with 7 additions and 5 deletions

View File

@ -200,14 +200,15 @@ class OakWeChatMpPlugin {
// add app.[ts/js] // add app.[ts/js]
realPages.push('app'); realPages.push('app');
// app.json 配置全局usingComponents
await this.getComponents(components, path.join(this.basePath, 'app'));
// resolve page components // resolve page components
for (const page of pages) { for (const page of pages) {
let isOak = getIsOak(page); let isOak = getIsOak(page);
if (isOak) { if (isOak) {
const oakPage = OakPagePath + page.replace( const oakPage =
new RegExp(OakPagePrefix), OakPagePath +
'pages' page.replace(new RegExp(OakPagePrefix), 'pages');
);
const instance = path.resolve(process.cwd(), oakPage); const instance = path.resolve(process.cwd(), oakPage);
if (!this.oakPages.has(oakPage)) { if (!this.oakPages.has(oakPage)) {
this.oakPages.add(oakPage); this.oakPages.add(oakPage);
@ -252,6 +253,7 @@ class OakWeChatMpPlugin {
const { usingComponents = {} } = fsExtra.readJSONSync( const { usingComponents = {} } = fsExtra.readJSONSync(
`${instance}.json` `${instance}.json`
); );
console.log(usingComponents);
const instanceDir = path.parse(instance).dir; const instanceDir = path.parse(instance).dir;
for (const c of Object.values(usingComponents)) { for (const c of Object.values(usingComponents)) {
if (c.indexOf('plugin://') === 0) { if (c.indexOf('plugin://') === 0) {