Alternative to html-webpack-plugin ✅ Renders Eta, EJS, Handlebars, Nunjucks, Pug, Twig templates "out of the box" ✅ Resolves source files of scripts, styles, images in HTML ✅ Uses a template as entry point
ISC License
138
stars
14
forks
source link
new eta template function only works if some data is specified in loaderOptions #60
If you create a partial eta template and import it into js without configuring any data in loaderOptions, an exception is thrown because __data__ is null, and the template doesn't work.
... possibly splitting that case into separate tests for each data passing mechanism would have caught this? I'm not very familiar with the tooling involved here.
it also might be worth looking at whether this is a problem with the other templating engines
Current behaviour
If you create a partial eta template and import it into js without configuring any data in loaderOptions, an exception is thrown because
__data__
is null, and the template doesn't work.Expected behaviour
The template should work without requiring developers to pass data in through the preprocessor config.
Reproduction Example
https://github.com/Kiirani/hbwp-template-repro
Environment
Additional context
The test case for this feature (https://github.com/webdiscus/html-bundler-webpack-plugin/tree/master/test/cases/js-tmpl-eta-compile) tests multiple methods of passing data, including through through the config - that's actually how I figured out why it wasn't working....
... possibly splitting that case into separate tests for each data passing mechanism would have caught this? I'm not very familiar with the tooling involved here.
it also might be worth looking at whether this is a problem with the other templating engines