Open stachu3478 opened 4 years ago
Lodash only gets bundled if you explicitly import it into files in your project. This shouldn't be necessary if using the games version of lodash. You should be able to write code assuming a global instance of lodash exists bound to _
without import.
A recent update to @types/lodash (v3.10.3) broke the ability to transparently assume a global lodash, so I added a shim to types.d.ts as a workaround.
If you happened to pull this repo within the past week, and you got compile errors regarding lodash which suggested importing it, try pulling the latest changes.
If you prefer explicitly importing (the games's version of) lodash, then yes you will need this external module definition.
If you're explicitly importing a different version of lodash, then it must be bundled.
It's been pointed out that my hotfix doesn't work / introduces other issues. Back to investigating how to handle lodash.
You can add the below to types.d.ts:
declare const _ = typeof lodash
I have gone in the problem where i have found a lot of unused bundled code (lodash) and found easy way to solve that.
As in Screeps the lodash module is included by default, i think it should not be bundled one more time. So changing:
... would save a lot of code bundled and improve smart bundling effect. However, there might be an issue with incompatible lodash version so it is still only an option.