问题
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