Giter Club home page Giter Club logo

Comments (7)

eiskalteschatten avatar eiskalteschatten commented on June 9, 2024 1

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.

hershmire avatar hershmire commented on June 9, 2024

👋🏼 Any thoughts on the issue above?

from node-config.

hershmire avatar hershmire commented on June 9, 2024

@lorenwest @markstos was this intentional? If so, what's the proposed direction when handling modules?

from node-config.

markstos avatar markstos commented on June 9, 2024

@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.

jdmarshall avatar jdmarshall commented on June 9, 2024

@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.

NilSet avatar NilSet commented on June 9, 2024

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.

markstos avatar markstos commented on June 9, 2024

@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.

#569

from node-config.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.