@@ -1166,14 +1166,19 @@ both ``app`` and ``checkout``:
1166
1166
{{ importmap(['app', 'checkout']) }}
1167
1167
{% endblock %}
1168
1168
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.
1177
1182
1178
1183
Using a Content Security Policy (CSP)
1179
1184
-------------------------------------
0 commit comments