Release configuration for Ionic project, similar to flavours in Android studio

為{幸葍}努か 提交于 2021-02-08 08:37:20

问题


Been looking into this without any luck. I understand that we can pass configuration to Ionic projects via the config.xml file. But I want to have different configuration for development and release builds.

Does anyone know about how this can be done?


回答1:


This is one approach that using the hooks to update a configuration file based on the specific environment you are building for.

You use a configuration variable when executing the cmd as the indicator of the environment.

config_target=qa cordova build --release android ios

then in the hook, check for the variable

var config_target = process.env.config_target || "local"; // default to local

http://www.kdmooreconsulting.com/blogs/build-a-cordova-hook-to-setup-environment-specific-constants/



来源:https://stackoverflow.com/questions/31507199/release-configuration-for-ionic-project-similar-to-flavours-in-android-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!