For example:
File 1:
const env = process.env.VARIABLE;
export const config: any = config[env.toLowerCase()];
File 2:
import { config } from '../file1';
class SomeClass {
constructor() {
console.log(config.someProperty);
}
}
export default new SomeClass();
This doesn't seem to work. config.someProperty is undefined. Any reason why?
Edit per request:
import { config } from '../file1';
export class SomeClass {
private myConfig = config.someProperty;
constructor() {
console.log(myConfig);
}
}