@@ -1095,16 +1095,19 @@ both ``app`` and ``checkout``:
1095
1095
{{ importmap(['app', 'checkout']) }}
1096
1096
{% endblock %}
1097
1097
1098
- By passing both ``app `` and ``checkout ``, the ``importmap() `` function will
1099
- output the ``importmap `` and also add a ``<script type="module"> `` tag that
1100
- loads the ``app.js `` file *and * the ``checkout.js `` file. It's important
1101
- to *not * call ``parent() `` in the ``importmap `` block. Each page can only
1102
- have *one * importmap, so ``importmap() `` must be called exactly once.
1103
-
1104
- If you want to execute *only * ``checkout.js ``
1105
- and *not * ``app.js ``, pass only ``checkout `` to ``importmap() ``.
1106
- In this case, still **both ** files are added to ``<script type="importmap"> ``,
1107
- but only ``checkout `` is executed (via ``<script type="module">import 'checkout';</script> ``).
1098
+ The ``importmap() `` function always includes the full import map to ensure all
1099
+ module definitions are available on the page. It also adds a ``<script type="module"> ``
1100
+ tag to load the specific JavaScript entry files you pass to it (in the example
1101
+ above, the ``app.js `` file *and * the ``checkout.js `` file).
1102
+
1103
+ .. warning ::
1104
+
1105
+ Do not call ``parent() `` inside the ``{% block importmap %} `` Twig block. Each
1106
+ page can include only one import map, so ``importmap() `` must be called exactly once.
1107
+
1108
+ If you want to execute *only * ``checkout.js `` (and not ``app.js ``), call
1109
+ ``{{ importmap('checkout') }} ``. In this case, the full import map will still be
1110
+ included in the page, but only the ``checkout.js `` file will actually be loaded.
1108
1111
1109
1112
Using a Content Security Policy (CSP)
1110
1113
-------------------------------------
0 commit comments