编译 app.json 配置全局usingComponents
This commit is contained in:
parent
213e5c78ac
commit
dd22b3bd9d
|
|
@ -200,20 +200,21 @@ 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);
|
||||||
realPages.push(oakPage);
|
realPages.push(oakPage);
|
||||||
}
|
}
|
||||||
await this.getComponents(components, instance, MODE.oak);
|
await this.getComponents(components, instance, MODE.oak);
|
||||||
} else {
|
} else {
|
||||||
realPages.push(page);
|
realPages.push(page);
|
||||||
const instance = path.resolve(this.basePath, page);
|
const instance = path.resolve(this.basePath, page);
|
||||||
|
|
@ -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) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue