解决 ctx 格式异常问题

This commit is contained in:
icssoa 2025-10-13 10:01:36 +08:00
parent 3cf7ee003e
commit 732000aec4
3 changed files with 14 additions and 1 deletions

View File

@ -1660,6 +1660,12 @@
// 删除临时页面
ctx.pages = ctx.pages?.filter((e) => !e.isTemp);
ctx.subPackages = ctx.subPackages?.filter((e) => !e.isTemp);
// 删除不需要的数据
for (const i in ctx) {
if (!["pages", "subPackages", "tabBar", "globalStyle", "uniIdRouter"].includes(i)) {
delete ctx[i];
}
}
// 加载 uni_modules 配置文件
const files = await glob.glob(rootDir("uni_modules") + "/**/pages_init.json", {
stat: true,

View File

@ -1,6 +1,6 @@
{
"name": "@cool-vue/vite-plugin",
"version": "8.2.13",
"version": "8.2.14",
"description": "cool-admin、cool-uni builder",
"types": "./dist/index.d.ts",
"main": "/dist/index.js",

View File

@ -29,6 +29,13 @@ export async function createCtx() {
ctx.pages = ctx.pages?.filter((e) => !e.isTemp);
ctx.subPackages = ctx.subPackages?.filter((e) => !e.isTemp);
// 删除不需要的数据
for (const i in ctx) {
if (!["pages", "subPackages", "tabBar", "globalStyle", "uniIdRouter"].includes(i)) {
delete ctx[i];
}
}
// 加载 uni_modules 配置文件
const files = await glob(rootDir("uni_modules") + "/**/pages_init.json", {
stat: true,