Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Necessity of ProvidePlugin #34

Open
alecmev opened this issue Dec 31, 2018 · 0 comments
Open

Necessity of ProvidePlugin #34

alecmev opened this issue Dec 31, 2018 · 0 comments

Comments

@alecmev
Copy link

alecmev commented Dec 31, 2018

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant