bumblebee icon indicating copy to clipboard operation
bumblebee copied to clipboard

while playing with recommender widget, noticed that underscore must be loaded globally - which is weird

Open romanchyla opened this issue 5 years ago • 2 comments

Expected Behavior

'underscore' is normally imported by modules

Actual Behavior

https://github.com/adsabs/bumblebee/blob/master/src/js/widgets/facet/widget.js has no such import

yet _.debounce() calls probably succeed

Suggests '_' is a global variable. Which it (normally) shouldn't be (conflicts)

Steps to Reproduce

romanchyla avatar Oct 15 '20 00:10 romanchyla

Yeah its always been a global, lodash/underscore add it to the global namespace by default. We don't explicitly add a shim for this in discovery.config. We could do that, but there are a number of places expecting a global, just like with Backbone and a few others -- I have them ignored by the linter here: https://github.com/adsabs/bumblebee/blob/master/.eslintrc.json If we add in the shim, we'll have to refactor some to include '_' in the deps (preferred, but might be a pain).

thostetler avatar Oct 15 '20 16:10 thostetler

Is webpack adding it to globals? I'm sure it wasn't always global (unless lodash changed something dramatical)

On Thu, Oct 15, 2020 at 12:41 PM Tim Hostetler [email protected] wrote:

Yeah its always been a global, lodash/underscore add it to the global namespace by default. We don't explicitly add a shim for this in discovery.config. We could do that, but there are a number of places expecting a global, just like with Backbone and a few others -- I have them ignored by the linter here: https://github.com/adsabs/bumblebee/blob/master/.eslintrc.json If we add in the shim, we'll have to refactor some to include '_' in the deps (preferred, but might be a pain).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/adsabs/bumblebee/issues/2074#issuecomment-709449645, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADEREXY4F4XFE6VOYQPJ53SK4Q4JANCNFSM4SRJANDQ .

romanchyla avatar Oct 15 '20 17:10 romanchyla