I have a file named "appsettings.json" which contains configurations for a specific purpose. I want to include variables from both "environment.ts" and "environment.prod.ts" in this file and access them within the environment files.
When I attempt to import/require "appsettings.json" and use its values, it works in development mode but not in "--prod" mode with aot enabled. However, it works fine with "--prod --aot=false" enabled.
An error is being thrown: ERROR in Error encountered resolving symbol values statically. Reference to a local (non-exported) symbol 'json'. Consider exporting the symbol (position 3:5 in the original .ts file), resolving symbol CONFIG
"ExtraConf" : {
"CDNPATH": "https://share-dev-cdn.test.net/",
"ICONPATH":"skin/icons/",
"APPLTITLE":"Title"
},
"Environments" : {
"production": false,
"appInsights": {
"appkey":"0908776554"
}
},
"EnvironmentsProd" : {
"production": true,
"appInsights": {
"appkey":"55678900"
}
}
environment.ts
declare var require: any;
var json:any = require("../../appsettings.json");
export const environment = json.Environments;