代码拉取完成,页面将自动刷新
const glob = require('glob');
const path = require('path');
const fs = require('fs');
const entryPc = {};
const entryMobile = {};
glob.sync(
path.join('./src/entry', '**', '*.vue'),
).forEach((fullPath) => {
if (fullPath.indexOf('Mobile') > -1) {
// 获取path 文件名
entryMobile[path.basename(fullPath, '.vue')] = fullPath;
} else if (fullPath.indexOf('Pc') > -1) {
entryPc[path.basename(fullPath, '.vue')] = fullPath;
} else {
entryMobile[path.basename(fullPath, '.vue')] = fullPath;
entryPc[path.basename(fullPath, '.vue')] = fullPath;
}
});
let entryMobileStr = '';
let entryPcStr = '';
for (const key in entryMobile) {
const appPath = '../../' + entryMobile[key];
entryMobileStr += '\n' + `export { default as ${key} } from '${appPath}';`;
}
entryMobileStr += '\n';
for (const key in entryPc) {
const appPath = '../../' + entryPc[key];
entryPcStr += '\n' + `export { default as ${key} } from '${appPath}';`;
}
entryPcStr += '\n';
// 在src/entrance目录下写入文件
fs.writeFileSync('./src/entrance/entranceMobile.js', entryMobileStr);
fs.writeFileSync('./src/entrance/entrancePc.js', entryPcStr);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。