Project

General

Profile

Actions

Bug #93236

closed

RequireJS Error at backend login

Added by Kevin Appelt almost 4 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Backend JavaScript
Target version:
Start date:
2021-01-06
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
11
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

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');

Actions

Also available in: Atom PDF