Skip to content

Commit f578e22

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

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
@@ -1166,14 +1166,19 @@ both ``app`` and ``checkout``:
11661166
{{ importmap(['app', 'checkout']) }}
11671167
{% endblock %}
11681168
1169-
By passing both ``app`` and ``checkout``, the ``importmap()`` function will
1170-
output the ``importmap`` and also add a ``<script type="module">`` tag that
1171-
loads the ``app.js`` file *and* the ``checkout.js`` file. It's important
1172-
to *not* call ``parent()`` in the ``importmap`` block. Each page can only
1173-
have *one* importmap, so ``importmap()`` must be called exactly once.
1174-
1175-
If, for some reason, you want to execute *only* ``checkout.js``
1176-
and *not* ``app.js``, pass only ``checkout`` to ``importmap()``.
1169+
The ``importmap()`` function always includes the full import map to ensure all
1170+
module definitions are available on the page. It also adds a ``<script type="module">``
1171+
tag to load the specific JavaScript entry files you pass to it (in the example
1172+
above, the ``app.js`` file *and* the ``checkout.js`` file).
1173+
1174+
.. warning::
1175+
1176+
Do not call ``parent()`` inside the ``{% block importmap %}`` Twig block. Each
1177+
page can include only one import map, so ``importmap()`` must be called exactly once.
1178+
1179+
If you want to execute *only* ``checkout.js`` (and not ``app.js``), call
1180+
``{{ importmap('checkout') }}``. In this case, the full import map will still be
1181+
included in the page, but only the ``checkout.js`` file will actually be loaded.
11771182

11781183
Using a Content Security Policy (CSP)
11791184
-------------------------------------

0 commit comments

Comments
 (0)