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

Necessity of ProvidePlugin #34

@alecmev

Description

@alecmev

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions