3 ms·
That benefit would be a breaking change. Node modules are stateful, so two packages suddenly sharing their dependency could have nasty side effects.
by jkrems 12y ago
That benefit would be a breaking change. Node modules are stateful, so two packages suddenly sharing their dependency could have nasty side effects.
- derefr 12y agoEek, I didn't realize anyone thought it was a good idea for modules to be holding state inside themselves. Simple-enough fix, though: drop an extra directory in there, call it "state", and have each state-container in that dir be named after the the hash of the dependency path you would have traversed to load it. Virtualize modifications to packages into those state-containers. (This is also pretty much how Windows protects itself from programs that think keeping their state in the Program Files directory is a good idea.)
- jkrems 12y agoI'm not sure we are talking about the same thing: I was talking about runtime state (think: singleton instances). A directory wouldn't solve that problem.