From e70269e751c153d525e625fd37ef13616ef0a471 Mon Sep 17 00:00:00 2001 From: xiaodongyu Date: Thu, 24 Feb 2022 13:18:52 +0800 Subject: [PATCH] Fix es6 module loading issue --- lib/moment-duration-format.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/moment-duration-format.js b/lib/moment-duration-format.js index f9038f3..d8c6e97 100644 --- a/lib/moment-duration-format.js +++ b/lib/moment-duration-format.js @@ -30,6 +30,11 @@ root.momentDurationFormatSetup = root.moment ? factory(root.moment) : factory; } })(this, function (moment) { + // Resolves es6 module loading issue + if (moment.version === undefined && moment.default) { + moment = moment.default; + } + // `Number#tolocaleString` is tested on plugin initialization. // If the feature test passes, `toLocaleStringWorks` will be set to `true` and the // native function will be used to generate formatted output. If the feature