ejs-compiled-loader
ejs-compiled-loader copied to clipboard
Upgrade to ejs ^3.0 or dynamic includes
I'm attempting to upgrade this loader to ejs 3.0 to make dynamic includes easier.
I have a few paths I'm attempting here:
-
Rebuild this with ejs 3.0. I'm running into an issue with the includes function itself. I believe I'm in the wrong scope for the template function of ejs.
-
Do dynamic includes using require or some other existing JS infra
I think the issue may ultimately have to do with how webpack-html-plugin is handling templates, but I'd love some guidance.
After some review, I think require is the easiest way to solve this for me.
However, I did find this caveat on the EJS readme I missed before: https://github.com/mde/ejs#caveats
I need to provide my own fn to do includes here. Seems reasonable.
You can use include without quotes on your pathname and it seems to work.
<%- include pathname_without_quotes %>