This code that renders the org.xwiki.platform.html.head UI extensions, has been moved in recent versions to {htmlheader.vm}}
The mentioned line produces the <script type="importmap"> in view mode and an empty string when the PDF export print preview is loaded. The culprit seems to be the outputSyntax=plain from the PDF export print preview URL. This seems to force a plain text rendering, instead of the requested 'xhtml/1.0'. This doesn't seem to be the case on master. The output syntax specified on the render() call should have priority over the output syntax specified on the HTTP request.
This message was sent by Atlassian Jira (v9.3.0#930000-sha1:287aeb6)
If image attachments aren't displayed, see this article.