Skip to content

Commit

Permalink
[TASK] Have "daterangepicker" use CDN moment.js
Browse files Browse the repository at this point in the history
We replace the script code to redefine the "moment.js" module import.
  • Loading branch information
mbrodala committed May 31, 2023
1 parent d15a075 commit 69fc520
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions .grunt/aliases.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"clean:js",
"bower",
"less",
"replace",
"umd",
"uglify"
]
Expand Down
10 changes: 10 additions & 0 deletions .grunt/replace.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
daterangepicker: {
src: '<%= paths.resources.public %>/JavaScript/daterangepicker/daterangepicker.js',
overwrite: true,
replacements: [{
from: "define(['moment'",
to: "define(['TYPO3/CMS/Formlog/moment'",
}],
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Make globaly available as well
define(['moment', 'jquery'], function (moment, jquery) {
define(['TYPO3/CMS/Formlog/moment', 'jquery'], function (moment, jquery) {
if (!jquery.fn) jquery.fn = {}; // webpack server rendering
if (typeof moment !== 'function' && moment.default) moment = moment.default
return factory(moment, jquery);
Expand Down

0 comments on commit 69fc520

Please sign in to comment.