81a093120c
按地图口径把 HBuilderX 工程改成官方 #vite(JS 版)CLI 工程: - 业务代码 git mv 进 src/(176 个 rename,逐文件字节比对零内容改动): App.vue / main.js / manifest.json / pages.json / uni.scss / pages/ / packageMine/ / components/ / utils/ / static/ / uni_modules/ / uni.promisify.adaptor.js - 新增官方骨架:package.json(@dcloudio/* 同版本 pin 3.0.0-5020620260917001,vite 精确 5.2.8,vue ^3.4.21;只留 h5 与 mp-weixin 脚本)、vite.config.js、shims-uni.d.ts;补 sass devDependency 以支持既有 lang="scss" - index.html 沿用本仓文件,入口改为 /src/main.js - manifest.json 删除 app-plus / quickapp / mp-alipay / mp-baidu / mp-toutiao 五个死平台段,只留 mp-weixin - .gitignore 加 dist/ - pnpm-workspace.yaml 新增 allowBuilds 白名单:pnpm 12 起 onlyBuiltDependencies 已被移除,且 strictDepBuilds 默认 true 会把 「未复核构建脚本」判成非零退出。白名单只列传递依赖 esbuild / @parcel/watcher / core-js / core-js-pure。 未使用 shamefully-hoist 或 node-linker=hoisted。 验收:pnpm build:mp-weixin 退出码 0,产物 app.json 的 pages / subPackages / tabBar / window 与改造前基线逐项一致; project.config.json 落产物且 appid = wxf7ee9cd5801bf7a6。
13 lines
373 B
JavaScript
13 lines
373 B
JavaScript
uni.addInterceptor({
|
|
returnValue (res) {
|
|
if (!(!!res && (typeof res === "object" || typeof res === "function") && typeof res.then === "function")) {
|
|
return res;
|
|
}
|
|
return new Promise((resolve, reject) => {
|
|
res.then((res) => {
|
|
if (!res) return resolve(res)
|
|
return res[0] ? reject(res[0]) : resolve(res[1])
|
|
});
|
|
});
|
|
},
|
|
}); |