javascript - Error properties not defined when pointing to a local variable -
i have following configuration file : /* env.js */ env_to_use = [ "local" ]; // local; dev; rec; pre; prod module.exports = { env_properties : { local : { root_url : "localhost", port : 3000, root_dir : "/home/user/project/" }, dev : { root_url : "devdomain", port : 3000, root_dir : "/apps/project/", } }, global_properties : { path_include : { path_express : env_properties[env_to_use].root_dir + 'express' } } }; and in file, want print 'path_express' value : /* test.js */ var env = require('./env.js'); console.log(env.global_properties.path_include.path_express); but when launch script command node test.js , following error : path_express : env_properties[env_to_use].root_dir + 'express' ^ referenceerror: env_pro...