Description
Hi,
My error pages are overridden with Twig, using the templates/bundles/TwigBundle/Exception/error.html.twig
template. In this template, I use the encore_entry_link_tags()
function and encore_entry_script_tags()
function.
The problem is that sometimes the 500 error pages in prod env do not have any stylesheets/scripts loaded as the related tags are not rendered.
I managed to make a reproducer: https://github.com/jmsche/webpack-encore-bundle-reproducer
I think the issue is when something during template rendering fails. Eg. here the following line will trigger an exception as no "test" entry exists: https://github.com/jmsche/webpack-encore-bundle-reproducer/blob/master/templates/500.html.twig#L4
IIUC the problem is in fact here: https://github.com/symfony/webpack-encore-bundle/blob/master/src/Asset/EntrypointLookup.php#L73
As the assets were previously loaded, they won't be for the error template.