Ok I have managed to do it by:
Step #1 add <script>document.API_BASE_URL = "{{{ API_BASE_URL }}}";</script>
to index.template.html
.
Step #2 In a boot file add:
if (ssrContext) {
ssrContext.API_BASE_URL = process.env.API_BASE_URL;
Vue.prototype.$API_BASE_URL = process.env.API_BASE_URL || 'http://localhost:7071/api';
} else {
Vue.prototype.$API_BASE_URL = document['API_BASE_URL'];
}
That seems to work but also seems very complicated, is there no simpler way of doing it?