看到文档里面说可以动态修改manifest.json,然后写在vue.config.js里面编译h5就报错
replaceManifest('h5.router.base', '/webs/')
fs.writeFileSync(manifestPath, Manifest, {
"flag": "w"
})
错误是
[HBuilder] 18:00:18.386 manifest.json解析失败
[HBuilder] 18:00:18.419 ERROR TypeError: Cannot read property 'h5' of undefined
[HBuilder] 18:00:18.452 TypeError: Cannot read property 'h5' of undefined
[HBuilder] 18:00:18.485 at getH5Options (/Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/uni-cli-shared/lib/manifest.js:47:26)
[HBuilder] 18:00:18.486 at Object.<anonymous> (/Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/lib/h5/index.js:29:5)
[HBuilder] 18:00:18.519 at Module._compile (internal/modules/cjs/loader.js:999:30)
[HBuilder] 18:00:18.520 at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
[HBuilder] 18:00:18.552 at Module.load (internal/modules/cjs/loader.js:863:32)
[HBuilder] 18:00:18.553 at Function.Module._load (internal/modules/cjs/loader.js:708:14)
[HBuilder] 18:00:18.586 at Module.require (internal/modules/cjs/loader.js:887:19)
[HBuilder] 18:00:18.586 at require (internal/modules/cjs/helpers.js:74:18)
[HBuilder] 18:00:18.619 at module.exports (/Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/index.js:47:27)
[HBuilder] 18:00:18.619 at /Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@vue/cli-service/lib/Service.js:78:7
[HBuilder] 18:00:18.652 项目 'fanqie-info' 发布h5失败.
请问一下怎么处理?完全按照官方文档写的,还是出错.....
https://uniapp.dcloud.io/collocation/vue-config
2 个回复
1***@qq.com
请问一下解决了吗?遇到类似的问题
c***@126.com (作者)
解决了