Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAvoid namespace imports in favor of named imports #3743
Comments
There's no technical issue with named imports besides the fact that it's difficult to emit them in our compiler in a way that fits incremental linking. We'll eventually do it, but we don't consider that a priority. A JavaScript-only pass can probably optimize such things on its own and do the tree shaking anyway. |
Thank you for your answer |
@sjrd Would it be acceptable to generate
The downside is that we'd hide the access behind a function. The alternative would be to make |
I'd rather we used refined |
For folks following this issue. There is discussion on #4010 (comment) to use namespace imports for module splitting. If that get's accepted, we'd probably close this issue as wontfix (unless there is strong reason to do this for non-SJS modules, but not for SJS modules). |
Relevant discussion on gitter:
So #4010 is less related to this than I initially thought. |
Currently, for the following code:
we were expecting to see something like:
but the output is more like (scalajs 1.0.0-M8, fast and full opt.):
The documentations mentions something similar.
We understand it may be considered as an optimization (and we have seen
Is it a request for more optimizations? Technically not out of scope, but we have already enough ideas and not enough time for those.
) but we wanted to know if it is the case here, or if there is a technical issue with named imports (as they may be used to improve tree shaking with webpack for example).