-
-
Notifications
You must be signed in to change notification settings - Fork 84
Description
Currently, the bundle performs de-duplication of the returned files. This is useful to avoid rendering the same <script> tag multiple times. But it makes it harder to render <link rel="preload"> in the <head> and then <script> at the end of the body (as here, we precisely need to get the full list twice).
The way to do it currently would be to call encore_entry_js_files and store the result in a variable used in both places. But this is not convenient at all. The variable must be defined in a scope higher than both places needing it, and it is very common to have a block wrapping the <script> tags to make it handy for child templates to add more, but blocks create a new scope and so mutating the array inside the block has no effect outside it. It is also quite fragile in case the variable name is used elsewhere in the template (as the head and the end of the body are at opposite sides of the rendering of the template).