Continuation of #28.
@KnisterPeter This line ...
https://github.com/okonet/ejs-loader/blob/4dbd9db88197c3c9d6bd60bb4f3ddea528767cfa/index.js#L23
... compiles a template during a Webpack build, so "this loader does not compile anything at compile time" seems factually incorrect to me. However, yes, it does produce code dependent on _.escape, and it's unfortunate that I have to use ProvidePlugin to supply the _.
A better approach, IMO, would be to have a loader option taking the name of the module to use ("lodash" or "underscore"), and supplying it to the template compiler via the imports option, preferably defaulting to "lodash". Inlining _.escape would be even better, but that isn't trivial to achieve correctly.
Why do I open an issue here, instead of just using ejs-compiled-loader? Well, I'm using it, for now, but I'd prefer to use this loader, since it has fewer dependencies and uses Lodash.