Deprecation: #97057 - Deprecate RequireJS support¶
See forge#97057
Description¶
The RequireJS project has been discontinued and was therefore replaced by native ECMAScript v6/v11 modules in TYPO3 in forge#96510.
The infrastructure for configuration and loading of RequireJS modules is now deprecated and will be removed in TYPO3 v13.
Impact¶
Registering modules via 'requireJsModules'
will still work.
These modules will be loaded after modules registered via 'javaScriptModules'
. Extensions that
use 'requireJsModules
will work as before but trigger a PHP E_USER_DEPRECATED
error.
Affected installations¶
Installations that register custom JavaScript modules for the TYPO3 backend.
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 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->packageRenderer->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'
}"
/>