Issue Bug Closed

#93236RequireJS Error at backend login

Kevin Appelt 01/06/21, 19:06 updated 10/07/21, 07:14

Description

I need to add a JS lib to the backend (more precisely to the backend login) which worked fine in v10 – and works fine in v11 after logging into the backend.

On login screen I can see an error 500 in the browser console (coming from requirejs-loader.js:67), which is the result of

Symfony\Component\Routing\Exception\ResourceNotFoundException
No routes found for "/ajax/core/requirejs&name=nameOfTheLibToLoad".

As said, the error is gone when logged in to the backend and the file is loaded as required.

This is the code, which registers the lib.

$pageRenderer->addRequireJsConfiguration([
    'shim' => [
        'nameOfTheLibToLoad' => [
            'exports' => 'nameOfTheLibToLoad'
        ]
    ],
    'paths' => [
        'nameOfTheLibToLoad' => PathUtility::getAbsoluteWebPath(
            ExtensionManagementUtility::extPath(
                'myext',
                'Resources/Public/JavaScript/'
            )
        )
            . 'filenameOfTheLibToLoadWithoutDotJs'
    ]
]);

This code works as expected (but fails due to the missing lib)

$pageRenderer->loadRequireJsModule('TYPO3/CMS/Myext/FileWithoutDotJs');

Reviews 2