Open jantimon opened 8 years ago
Ah yes it assumes you use _
as a global, but that does not make much sense.
Ouch, I didn't even know this feature even existed... But here's what I noticed: when using lodash to translate a template to a function this can be found on some translations:
__e = _.escape
This can be tested by uninstalling underscore and installing lodash instead. Weird enough, this only happens on some tests, the first and second tests on loaderTests.js. I tried several versions on lodash and the problem still persists. I'm not a big fan of this library so I'm not capable of telling if there's a special type of configuration that could avoid this output. These kinds of issues could be managed much better by creating another package and moving all compatibiliity code to support lodash there.
tl;dr Someone should create a lodash-template-loader
In my minimalistic fallback loader I just add lodash as dependency to the template:
https://github.com/ampedandwired/html-webpack-plugin/blob/feature/loaders/lib/loader.js#L25
When using the escape feature of lodas/underscore templates I receive "ERROR in ReferenceError: _ is not defined"