emaphp / underscore-template-loader

A Underscore and Lodash template loader for Webpack
MIT License
104 stars 24 forks source link

Global underscore used when engine is specified and using imports #22

Open demerzel3 opened 7 years ago

demerzel3 commented 7 years ago

An interesting bug arises when both engine and imports are used: imports are correctly loaded from the specified engine and passed to the template function, but the _ symbol inside of the template function refers to the global _ instead of the engine's one.

I pinned down the problem to the usage of the Function() syntax, here's a CodePen to prove my point: http://codepen.io/anon/pen/JRybKm?editors=0012

I think it can be easily solved by passing the engine directly in the call to Function alongside the other imports, I will file a PR to fix it soon.

SpaceK33z commented 7 years ago

I think this is somewhat related to #19. I'm interested in your PR though :).

SpaceK33z commented 7 years ago

And also related to #13.