Skip to content

Commit 8662e6d

Browse files
committed
Merge branch '6.4' into 7.2
* 6.4: Tweaks and rewords [AssetMapper] Adding info that always *all* entrypoints are included…
2 parents 45ee853 + 45c11e5 commit 8662e6d

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

frontend/asset_mapper.rst

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,14 +1085,19 @@ both ``app`` and ``checkout``:
10851085
{{ importmap(['app', 'checkout']) }}
10861086
{% endblock %}
10871087
1088-
By passing both ``app`` and ``checkout``, the ``importmap()`` function will
1089-
output the ``importmap`` and also add a ``<script type="module">`` tag that
1090-
loads the ``app.js`` file *and* the ``checkout.js`` file. It's important
1091-
to *not* call ``parent()`` in the ``importmap`` block. Each page can only
1092-
have *one* importmap, so ``importmap()`` must be called exactly once.
1093-
1094-
If, for some reason, you want to execute *only* ``checkout.js``
1095-
and *not* ``app.js``, pass only ``checkout`` to ``importmap()``.
1088+
The ``importmap()`` function always includes the full import map to ensure all
1089+
module definitions are available on the page. It also adds a ``<script type="module">``
1090+
tag to load the specific JavaScript entry files you pass to it (in the example
1091+
above, the ``app.js`` file *and* the ``checkout.js`` file).
1092+
1093+
.. warning::
1094+
1095+
Do not call ``parent()`` inside the ``{% block importmap %}`` Twig block. Each
1096+
page can include only one import map, so ``importmap()`` must be called exactly once.
1097+
1098+
If you want to execute *only* ``checkout.js`` (and not ``app.js``), call
1099+
``{{ importmap('checkout') }}``. In this case, the full import map will still be
1100+
included in the page, but only the ``checkout.js`` file will actually be loaded.
10961101

10971102
Using a Content Security Policy (CSP)
10981103
-------------------------------------

0 commit comments

Comments
 (0)