I have found the solution:
The shim has to be:
datetimepicker: { exports: "$.fn.datetimepicker" }
Here are the files:
amd/src/config.js
define([], function () {
window.requirejs.config({
paths: {
//Enter the paths to your required java-script files
"moment": M.cfg.wwwroot + '/admin/tool/myplugin/js/moment.min',
"moment-fr": M.cfg.wwwroot + '/admin/tool/myplugin/js/moment-fr', // bootsrap 4 bundled with popper
"bootstrap": M.cfg.wwwroot + '/admin/tool/myplugin/js/bootstrap.bundle.min',
"datepickerfr": M.cfg.wwwroot + '/admin/tool/myplugin/js/bootstrap-datepicker.fr',
"datepicker": M.cfg.wwwroot + '/admin/tool/myplugin/js/datepicker',
"datetimepicker":M.cfg.wwwroot + '/admin/tool/myplugin/js/tempusdominus-bootstrap-4',
},
shim: {
//Enter the "names" that will be used to refer to your libraries
bootstrap: { deps: ["jquery"], exports: 'bootstrap'}, datepicker: { deps: ['bootstrap'], exports: "datepicker" },
datepickerfr: { deps: ['datepicker'], exports: "datepicker" },
datetimepicker: { exports: "$.fn.datetimepicker" }
}
});
});
amd/src/app.js
define([
'jquery',
'tool_myplugin/moment',
'tool_myplugin/bootstrap',
'tool_myplugin/datepicker',
'tool_myplugin/datetimepicker'
],
function ($,moment) {
//alert('bootstrap'+$.fn.tooltip.Constructor.VERSION);
//alert(moment({hour: 10, minute: 0}));
function initManage() {
$(document).ready(function () {
$('#datepicker').datepicker({
weekStart: 1,
todayBtn: "linked",
language: "fr",
locale: 'fr',
todayHighlight: true,
format: "dd/mm/yyyy",
orientation: "auto right" }); $('#datetimepicker1').datetimepicker({
format: 'HH:mm',
use24hours: true,
defaultDate: moment({hour: 9,minute:0}) });
amd/src/datetimepicker.js
define(['tool_myplugin/config', 'datetimepicker'], function(unused,datetimepicker) {
return datetimepicker;
}
);
amd/src/moment.js
define(['tool_myplugin/config', 'moment','moment-fr'], function(unused,moment) {
moment.locale('fr');
window.moment = moment;
if (!window.moment) {
alert("moment ko");
}
//if no return, error:TypeError: moment is not a function
return moment;
}
);
amd/scr/datepicker.js
define(['tool_myplugin/config', ,'datepicker','datepickerfr',], function(unused,datepicker) {
return datepicker;
}
);
amd/src/datepickerfr.js
define(['tool_myplugin/config', 'datepickerfr'], function(unused,datepickerfr) {
return datepickerfr;
}
);