Comments (7)
We've also had that problem since version 3.3.8 came out. My colleague and I have been working on it for two days and the only real way we've found to solve it is to fix the version to 3.3.7.
The problem seems to be this merge: #516. If I go into the config.js
in node_modules and revert the change by hand, it works fine.
from node-config.
👋🏼 Any thoughts on the issue above?
from node-config.
@lorenwest @markstos was this intentional? If so, what's the proposed direction when handling modules?
from node-config.
@hershmire The regression was not intentional. I've asked @fgheorghe who wrote the patch #516 to investigate. Ideally we'd like that fix without regressions, but maybe we can't have both and have to choose.
from node-config.
@markstos you sure about that?
If you unroll their code they are running:
config.util.setModuleDefaults('myModule', defaults);
const apple = config.get('myModule.apple');
config.util.setModuleDefaults('myModule', defaults);
const apple = config.get('myModule.apple');
Which I'm pretty sure the docs imply you should not do.
My read on setModuleDefaults is that you should not be calling it when running a function in your module, you should be running it when the module loads. That way repeated calls do not trigger this problem.
from node-config.
I just ran into this problem when resolving two different versions of a package in my dependency tree. The package tries to call config.util.setModuleDefaults('myModule', defaults);
in both versions, at module load.
How can a package ensure it has defaults set in an idempotent way?
I realize that its somewhat dangerous for two different versions of a library to be setting default values, because the defaults might change between versions, causing default values from the past or future of the package to be seen, but in the case where the defaults are the same, maybe it could be made to be a no-op instead of breaking?
from node-config.
@NilSet It seems like each sub-module should have a private configuration. The best way to do this may be with breaking changes. It was addressed in this fork, which should perhaps be published as it's own module.
from node-config.
Related Issues (20)
- Allow different default.json for environments HOT 1
- [BUG] Improve the documentation on Warning "WARNING: NODE_ENV value of 'local' is ambiguous" HOT 2
- [BUG] RegExp are proxified which breaks them
- custom-environment-variables.json says variable is not defined. HOT 1
- Feature Request: First class Kubernetes secret files support HOT 3
- [BUG] Cypress component testing fails with error `<CONFIG_VARIABLE> is not defined`
- Deal With Async Properties in DeferConfig HOT 1
- [BUG] Documentation is missing HOT 4
- [BUG] custom-environment-variables file does not support cjs extension HOT 2
- [BUG] Extra quotes on config file broke app HOT 5
- Cannot use defer with esbuild (fix: export defer from config) HOT 1
- Unable to use
- [BUG] Configuration files with different extensions and APP_INSTANCE not loaded in the right order HOT 2
- [BUG] Javascript getters calling during config initialization
- [BUG] Empty key in YAML sets value to null HOT 2
- [BUG] Environment variable substitution fails silently if "__format" parser is not supported HOT 1
- Project breaks after updating ts version (using .cjs config files)
- v3.3.10 is a breaking change for webpack, which does not install json5 dep HOT 18
- Disable some "defaults", like local.{ext} loading HOT 3
- [BUG] node-config package.json has not all the parsers available installed as production dependencies HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-config.