Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

能否打包时不强制依赖 manifest.json 文件 #4839

Closed
waset opened this issue Apr 15, 2024 · 1 comment
Closed

能否打包时不强制依赖 manifest.json 文件 #4839

waset opened this issue Apr 15, 2024 · 1 comment

Comments

@waset
Copy link

waset commented Apr 15, 2024

fs.readFileSync(path.join(inputDir, 'manifest.json'), 'utf8')

cli

cli 时经常需要将 manifest.json 加入 manifest.json 以隐藏关键配置,以及使用 @uni-helper/vite-plugin-uni-manifest 管理 manifest.json

HBuilderX

HBuilderX 中本身就会因为 manifest.json 为空会爆红

建议

在以上判断时如果 manifest.json 文件不存在,则创建一个空的 manifest.json 文件,让后续运行拿不到配置项时再报错,而不是在打包时就报错

Tip

配置项应该依赖运行时环境而不是打包时

@waset waset closed this as completed Apr 15, 2024
@waset
Copy link
Author

waset commented Apr 15, 2024

可以使用 @waset/uni-reset-manifest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant