Closed kyllle closed 8 years ago
_
needs to be globally available for this to work. Can you try to add the following to your webpack config?
{
plugins: [
new webpack.ProvidePlugin({
_: 'underscore'
})
]
}
That's it, thanks for this!! I had originally added plugins inside the modules object.
@SpaceK33z
Not sure why we can't use underscore
functions inside underscore
templates.
If underscore
is what renders the templates, then is it not what evaluates the expressions or statements inside the templates, such as _.each()
?
When I use this plugin and use an underscore function inside my template I get an error
Uncaught ReferenceError: _ is not defined
pointing to the_.each()
being used in the template?