Pregunta

How to separate string constants depends on environment (dev\test\prod) build in Sharepoint Framework?

¿Fue útil?

Solución

From a dev on the team - Interesting question. We don't have a way to do that with config files or manifests right now, but they can do it by saying something like

const strings = DEBUG ? require('debug_strings') : require('prod_strings');

And listing "debug_strings" and "prod_strings" as separate entries in their config.json. This is switching on build flavor, not environment, but that might be similar to what they have in mind.

Otros consejos

Question is unclear. Constant is something that is hard coded. You can take the values from web.config entries. So each time you move the code to new environment, you just need to change the values in web.config file which is accessible.

https://stackoverflow.com/questions/4595288/reading-a-key-from-the-web-config-using-configurationmanager

Licenciado bajo: CC-BY-SA con atribución
scroll top