Accordingly to https://requirejs.org/docs/errors.html#notloaded, the current implementation should be wrong.
Not sure how to adjust https://github.com/TYPO3/TYPO3.CMS/blob/master/Build/Sources/TypeScript/dashboard/Resources/Public/TypeScript/ChartInitializer.ts to generate the expected code, but https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/dashboard/Resources/Public/JavaScript/ChartInitializer.js currently contains:
define(['require',
'exports',
'jquery'], (function (e, t, n) {
'use strict';
let r = e('TYPO3/CMS/Dashboard/Contrib/chartjs');
Which should be:
define(['require',
'exports',
'jquery', 'TYPO3/CMS/Dashboard/Contrib/chartjs'], (function (e, t, n) {
'use strict';
let r = e('TYPO3/CMS/Dashboard/Contrib/chartjs');
See:
In particular, the following will not work:
//THIS WILL FAIL
define(['require'], function (require) {
var namedModule = require('name');
});
This fails because requirejs needs to be sure to load and execute all dependencies before calling the factory function above. If a dependency array is given to define(), then requirejs assumes that all dependencies are listed in that array, and it will not scan the factory function for other dependencies. So, either do not pass in the dependency array, or if using the dependency array, list all the dependencies in it.
If part of a require() callback, all the dependencies need to be listed in the array:
require(['require', 'name'], function (require) {
var namedModule = require('name');
});
Be sure that require('name') only occurs inside a define() definition function or a require() callback function, never in the global space by its own.