Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I tried without success to configure this module using the
.screepsrc
method. I believe I am using Node v10, but I am not sure as I am running screeps server on windows through steam.Digging through code, it appears that this line doesn't work as I would have expected:
I would expect the above to pick values from
ENV
, thenopts.history
, thenDEFAULT
. And thus, with an emptyENV
and values inopts.history
, it should override the default.However, that's not what happens. Consider this example:
I believe what happens internally in
Object.assign(a, b, a)
is something along those lines:a.x
(first param) tob.x
(second param), which seta.x
to10
a.x
(first param) toa.x
(second param) as the last param takes priority, but nowa.x = 10
and thus we're just overridinga.x
with the same value,a.x
.a.y
andb.y
It does not happen with the following code, because the object being set is brand new:
I made the update in my local node_modules and the config in
./.screepsrc
is honored.If you're able to reproduce the problem on your end here is a fix for you! I think this might still be good to ship because that's the way MDN recommend to do merging:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign#Merging_objects_with_same_properties