I noticed a bunch of module-scope function calls; these get executed every time the corresponding module (and thereby owid.mjs) is loaded.
Many of these values are not needed at all, and some are only needed in "rare" cases.
There are probably more such things, I didn't do a full-on search of everything. A rough regex to find those is ^(export )?(const|let) [\w_.]+ = [^(]*\w\( (although that won't find multiline ones like entities [newline] .filter(...)).
I also discovered that the result of some of these, especially the ones in CustomSchemes, are never accessed at all.
By marking them with @__NO_SIDE_EFFECTS__, Rollup can eliminate (i.e. tree-shake) the call entirely from the bundle.
I think there is no way to do "proper" lazy properties, i.e. ones that are not a function call, without wrapping them in a class. Am I right? I would love to be proven otherwise :)
I noticed a bunch of module-scope function calls; these get executed every time the corresponding module (and thereby
owid.mjs
) is loaded.Many of these values are not needed at all, and some are only needed in "rare" cases. There are probably more such things, I didn't do a full-on search of everything. A rough regex to find those is
^(export )?(const|let) [\w_.]+ = [^(]*\w\(
(although that won't find multiline ones likeentities [newline] .filter(...)
).I also discovered that the result of some of these, especially the ones in
CustomSchemes
, are never accessed at all. By marking them with@__NO_SIDE_EFFECTS__
, Rollup can eliminate (i.e. tree-shake) the call entirely from the bundle.I think there is no way to do "proper" lazy properties, i.e. ones that are not a function call, without wrapping them in a class. Am I right? I would love to be proven otherwise :)