Skip to content

Commit

Permalink
fix: avoid dynamic import (#386)
Browse files Browse the repository at this point in the history
  • Loading branch information
xfournet committed Oct 6, 2021
1 parent 46bf512 commit dd5b194
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions lib/nconf.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,24 @@ nconf.version = require('../package.json').version;
//
// Setup all stores as lazy-loaded getters.
//
['argv', 'env', 'file', 'literal', 'memory'].forEach(function (store) {
var name = common.capitalize(store);
nconf.__defineGetter__('Argv', function () {
return require('./nconf/stores/argv').Argv;
});

nconf.__defineGetter__('Env', function () {
return require('./nconf/stores/env').Env;
});

nconf.__defineGetter__('File', function () {
return require('./nconf/stores/file').File;
});

nconf.__defineGetter__('Literal', function () {
return require('./nconf/stores/literal').Literal;
});

nconf.__defineGetter__(name, function () {
return require('./nconf/stores/' + store)[name];
});
nconf.__defineGetter__('Memory', function () {
return require('./nconf/stores/memory').Memory;
});

//
Expand Down

0 comments on commit dd5b194

Please sign in to comment.