Issue Bug Closed

#106564Generated importmaps are not cacheable in frontend

Benjamin Franzke 04/12/25, 15:12 updated 08/12/25, 14:35

Description

When loading a JavaScript module in frontend context, a importmap is rendered with a nonce, preventing the page from being cached:

<f:asset.module identifier="bootstrap"/>

Output with nonce:

<script type="importmap" nonce="gy9PpoqTXQ3FJUK3zMFNc5iqqh7qaM6MIwujT0A7bgdjgKwHiX2dKw">{"imports":{"@typo3/core/":"/typo3/sysext/core/Resources/Public/JavaScript/"…}}</script>
<script type="module" async="async" src="/typo3/sysext/core/Resources/Public/JavaScript/Contrib/bootstrap.js?bust=79ea92c419e74329bd1e25b52201a0586f94c1a5"></script>

Expected Output without a nonce (but sha256 in CSP header):

<script type="importmap">{"imports":{"@typo3/core/":"/typo3/sysext/core/Resources/Public/JavaScript/"…}}</script>
<script type="module" async="async" src="/typo3/sysext/core/Resources/Public/JavaScript/Contrib/bootstrap.js?bust=79ea92c419e74329bd1e25b52201a0586f94c1a5"></script>

Reviews 2