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 'require
will
have no effect. The PageRenderer endpoints
\TYPO3\
and
\TYPO3\
have been removed and must no longer be called.
The respective include
property of the ViewHelper
<f:
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/
,
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\
instead
of \TYPO3\
to load the ES6 module:
// via PageRenderer
$this->pageRenderer->loadJavaScriptModule('@vendor/my-extension/example.js');
In Fluid templates include
is to be used instead of
include
:
In Fluid template the include
property of the
<f:
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.