@venncity/nested-config
v3.1.30
Published
![Coverage](https://api.venn.city/production/coverage/badge?branch=master&repository=@venncity/nested-config)
Downloads
2,107
Readme
Nested config
Extends the node config module to combine parent and nested packages config
Node config does not support getting configuration defined inside a npm package. It always takes the config from the config files under the working directory so configuration of packages are ignored.
This package merges the configuration defined inside npm packages into the parent config and so you can get the configuration defined inside packages seamlessly.
Usage:
Everywhere you use config in an npm package, require it like so:
const config = require('@venncity/nested-config')({ modulePath: __dirname})
NestedConfig Webpack Build Rule:
This package also includes nestedConfigBuildRule which executes similar logic to what the package does in runtime, except it runs it at build time. Then it injects the prebuiltConfigJson as a "hardcoded" parameter of bested-config:
const config = require('@venncity/nested-config')({ prebuiltConfigJson: "\{ key1: value1, key2: value2, ...\}"})
When called using the prebuiltConfigJson param, nested config does not rely on runtime filesystem structures and thus can be executed from a webpack bundle.