程序在云制作的自定义基座调试完成后,通过云生成发行包,发行包安装后缺少页面内容,通过对比文件发现是安装后的目录下缺少www文件夹
详细情况见附件
package.json如下
{
"name": "zhi-hui-board-pro",
"version": "2.0.0",
"description": "绘王Ink Android 客户端",
"scripts": {
"dev:h5": "cross-env UNI_INPUT_DIR=. uni",
"dev:h5:mock": "concurrently -k -n MOCK,H5 -c yellow,cyan \"npm:mock:start\" \"npm:dev:h5\"",
"build:h5": "cross-env UNI_INPUT_DIR=. uni build",
"dev:android": "cross-env UNI_INPUT_DIR=. uni -p app",
"build:android": "cross-env UNI_INPUT_DIR=. uni build -p app",
"check:native": "node scripts/check-native-deps.mjs",
"android:sync-host": "powershell -NoProfile -ExecutionPolicy Bypass -File scripts/sync_android_host.ps1",
"android:prepare-host": "npm run check:native && npm run build:android && npm run android:sync-host",
"mock:start": "python -u mock_server/server.py",
"mock:test": "python scripts/test_mock.py",
"test:online-library": "node --experimental-default-type=module scripts/test-online-library.mjs",
"test:community-market": "node --experimental-default-type=module scripts/test-community-market.mjs",
"design:crop": "python scripts/crop_design_pages.py --write",
"design:render": "node scripts/render-design-pages.mjs --write",
"design:check": "python scripts/crop_design_pages.py --check && node scripts/render-design-pages.mjs --check",
"check": "node scripts/check-project.mjs && npm run test:online-library && npm run test:community-market && npm run design:check && node scripts/audit-prototype.mjs && node scripts/test-qr.mjs && node scripts/test-storage.mjs"
},
"dependencies": {
"@dcloudio/uni-app": "3.0.0-alpha-5020120260710001",
"@dcloudio/uni-app-plus": "3.0.0-alpha-5020120260710001",
"@dcloudio/uni-components": "3.0.0-alpha-5020120260710001",
"@dcloudio/uni-h5": "3.0.0-alpha-5020120260710001",
"ag-psd": "31.0.2",
"epubjs": "^0.3.93",
"pinia": "2.1.7",
"uview-plus": "3.8.55",
"vue": "3.4.21",
"vue-i18n": "9.14.5"
},
"devDependencies": {
"@dcloudio/types": "3.4.31",
"@dcloudio/uni-cli-shared": "3.0.0-alpha-5020120260710001",
"@dcloudio/uni-stacktracey": "3.0.0-alpha-5020120260710001",
"@dcloudio/vite-plugin-uni": "3.0.0-alpha-5020120260710001",
"concurrently": "9.2.4",
"cross-env": "7.0.3",
"pixelmatch": "^7.1.0",
"playwright-core": "^1.52.0",
"pngjs": "^7.0.0",
"rollup": "4.62.2",
"sass": "1.63.2",
"vite": "5.2.8"
},
"overrides": {
"@intlify/core-base": "9.14.5",
"@intlify/message-compiler": "9.14.5",
"@intlify/message-resolver": "9.14.5",
"@intlify/runtime": "9.14.5",
"@intlify/vue-devtools": "9.14.5",
"esbuild": "0.25.12",
"express": "4.22.2",
"postcss": "8.5.19"
}
}
vite.config.js如下:
/**
* ============================================================
* uni-app CLI 构建配置
* ============================================================
* ag-psd 的 pako 与 epubjs 的 jszip 内嵌源码包含 C 语言 #ifdef 文本,uni 条件编译器会误判。
* 在依赖进入 uni 插件前仅清理注释标记,不修改 node_modules 或运行时代码。
*/
import { defineConfig } from "vite";
import uni from "@dcloudio/vite-plugin-uni";
import { existsSync, readFileSync } from "node:fs";
import { fileURLToPath, URL } from "node:url";
function isConditionSensitiveDependency(id) {
const normalizedId = id.replaceAll("\\", "/");
return (
normalizedId.includes("/node_modules/pako/") ||
normalizedId.includes("/node_modules/ag-psd/") ||
normalizedId.includes("/node_modules/jszip/")
);
}
function sanitizeConditionComments(code) {
return code
.replaceAll("#ifdef", "ifdef")
.replaceAll("#ifndef", "ifndef")
.replaceAll("#endif", "endif");
}
const sanitizeDependencyConditionComments = {
name: "sanitize-dependency-condition-comments",
enforce: "pre",
load(id) {
if (!isConditionSensitiveDependency(id)) return null;
// 5.21 的 uni 条件编译发生在依赖 transform 之前,必须在 load 阶段返回已清理源码。
const filename = id.split("?")[0];
if (!filename.endsWith(".js") || !existsSync(filename)) return null;
return sanitizeConditionComments(readFileSync(filename, "utf8"));
},
transform(code, id) {
if (!isConditionSensitiveDependency(id)) return null;
return sanitizeConditionComments(code);
},
};
export default defineConfig({
plugins: [sanitizeDependencyConditionComments, uni()],
commonjsOptions: {
include: [/node_modules/],
},
resolve: {
// pako 源码中的 C 预处理注释会被 uni-app 误判;官方 minified 构建不含这些标记。
alias: {
pako: fileURLToPath(
new URL("./node_modules/pako/dist/pako.min.js", import.meta.url)
),
},
},
server: {
host: "0.0.0.0",
},
});
此为dist/build/app目录结构
npm run build:android日志:
D:\zhang\workDir\red-device-app>npm run build:android
zhi-hui-board-pro@2.0.0 build:android
cross-env UNI_INPUT_DIR=. uni build -p app
编译器版本:5.21(vue3)
正在编译中...
uni-app 有新版本发布,请执行 npx @dcloudio/uvm@latest alpha 更新,更新日志详见:https://download1.dcloud.net.cn/hbuilderx/changelog/5.23.2026080313-alpha.html
DONE Build complete.
运行方式:打开 HBuilderX, 导入 dist\build\app 运行。
云打包日志:
[HBuilder] 09:55:07.387 项目 red-device-app [UNI93903A7]的打包状态:
[HBuilder] 09:55:07.387 时间: 2026-08-12 09:54:47 类型: Android自有证书 队列中
[HBuilder] 09:55:07.387 目前云打包排队人数较多,当前打包任务位于队列第 2 位,预计 1 分钟内进入打包状态。
[HBuilder] 09:55:07.891
[HBuilder] 09:55:07.891 项目 red-device-app [UNI93903A7]的打包状态:
[HBuilder] 09:55:07.891 时间: 2026-08-12 09:54:47 类型: Android自有证书 正在云端打包
[HBuilder] 09:55:07.891 当前项目使用了原生插件,如果原生插件依赖了三方库且三方库需要联网下载,可能会消耗较长时间,预计 3-30 分钟完成打包,请耐心等待。
[HBuilder] 09:56:07.471
[HBuilder] 09:56:07.471 项目 red-device-app [UNI93903A7]的打包状态:
[HBuilder] 09:56:07.471 时间: 2026-08-12 09:54:47 类型: Android自有证书 正在云端打包
[HBuilder] 09:56:07.471 当前项目使用了原生插件,如果原生插件依赖了三方库且三方库需要联网下载,可能会消耗较长时间,预计 3-30 分钟完成打包,请耐心等待。
[HBuilder] 09:57:07.210
[HBuilder] 09:57:07.210 项目 red-device-app [UNI93903A7]打包成功:
[HBuilder] 09:57:07.210
[HBuilder] 09:57:07.210 类型: Android自有证书 下载地址: https://app.liuyingyong.cn/build/download/cbed5d30-95f0-11f1-b4d8-875cd4c07415 (注意该地址为临时下载地址,只能下载5次) [一键上传到uniCloud(更优惠的cdn、长期稳定)]
