Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function loadMomentModule () {
const momentModulePath = require.resolve(MOMENT_MODULE_NAME);
const savedMomentModule = require.cache[momentModulePath];
delete require.cache[savedMomentModule];
const moment = require(momentModulePath);
momentDurationFormatSetup(moment);
if (savedMomentModule)
require.cache[momentModulePath] = savedMomentModule;
else
delete require.cache[momentModulePath];
return moment;
}