-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamic routes not parsed #325
Comments
The require part is done by webpack so it inherits all features and limitations of webpacks require. What you could try is the following: https://webpack.github.io/docs/context.html
Which would basically require all images but use only the one of your variable. |
Thanks for the suggestion. Ideally I'd like to keep webpack syntax out of the template. I unsuccessfully tried: function HtmlInspect() {}
HtmlInspect.prototype.apply = compiler => {
compiler.plugin('compilation', compilation => {
compilation.plugin('html-webpack-plugin-before-html-generation', (htmlPluginData, callback) => {
let assetJson = JSON.parse(htmlPluginData.plugin.assetJson);
assetJson.push('/test-1.jpg');
htmlPluginData.plugin.assetJson = JSON.stringify(assetJson);
callback(null, htmlPluginData);
});
});
};
module.exports = HtmlInspect; Do you know of a way I could pass the rendered template HTML though a loader during one of these events to allow webpack to discover the additional resources? |
Use a JavaScript file as root template - require the real template and use the require context to load the additional assets - pass the result to your template and return the string |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Hi,
I have a configuration using
underscore-template-loader
and I cannot seem to get it to parse any routes that are created dynamically with this plugin.By that I mean, if I create a non-dynamic image tag:
The
file-loader
discovers, loads and emits the asset, however if I create the tag like so:The asset is not discovered by the file loader.
As an aside, the following works:
But using a variable produces an error:
My configuration for the template loader looks like:
A post loader will not work as the template is not rendered until it reaches the plugin. I can inspect the rendered HTML within the
html-webpack-plugin-after-html-processing
event handler but I'm not sure what to do with it at that point since it's already passed though the loader pipeline.In order to get this far I referenced the following issues:
Please let me know if I'm missing something or if I can provide some more information.
Thanks
The text was updated successfully, but these errors were encountered: