Breaking: #101266 - Remove RequireJS

See forge#101266

Description

The RequireJS project has been discontinued and was therefore deprecated in TYPO3 v12 with forge#96510 in favor of native ECMAScript v6/v11 modules (added in forge#96510).

The infrastructure for configuration and loading of RequireJS modules is now removed.

Impact

Registering FormEngine JavaScript modules via 'requireJsModules' will have no effect. The PageRenderer endpoints \TYPO3\CMS\Core\Page\PageRenderer::loadRequireJs() and \TYPO3\CMS\Core\Page\PageRenderer::loadRequireJsModule() have been removed and must no longer be called. The respective includeJavaScriptModules property of the ViewHelper <f:be.pageRenderer> ViewHelper has also been removed.

Affected installations

TYPO3 installations using RequireJS modules to provide JavaScript in the TYPO3 backend, or – less common – use PageRenderer RequireJS infrastructure for frontend JavaScript module loading.

Migration

Migrate your JavaScript from the AMD module format to native ES6 modules and register your configuration in Configuration/JavaScriptModules.php, also see forge#96510 and ES6 in the TYPO3 Backend for more information:

# Configuration/JavaScriptModules.php
<?php

return [
    'dependencies' => ['core', 'backend'],
    'imports' => [
        '@vendor/my-extension/' => 'EXT:my_extension/Resources/Public/JavaScript/',
    ],
];

Then use \TYPO3\CMS\Core\Page\PageRenderer::loadJavaScriptModules() instead of \TYPO3\CMS\Core\Page\PageRenderer::loadRequireJsModule() to load the ES6 module:

// via PageRenderer
$this->pageRenderer->loadJavaScriptModule('@vendor/my-extension/example.js');

In Fluid templates includeJavaScriptModules is to be used instead of includeRequireJsModules:

In Fluid template the includeJavaScriptModules property of the <f:be.pageRenderer> ViewHelper may be used:

<f:be.pageRenderer
   includeJavaScriptModules="{
      0: '@vendor/my-extension/example.js'
   }"
/>

See also

ES6 in the TYPO3 Backend for more info about JavaScript in TYPO3 Backend.