When importing as an ES module, the umd wrapper fails to account for the possible 'default' export name of moment.js (2.19 added the 'module' property to the package.json, and webpack follows it instead of main.)
module.exports = factory(require('moment')); // Node
should add an interop function call between factory() and the return of require()
something like:
function interop (x) {
return x && x.default || x;
}
module.exports = factory(interop(require('moment'))); // Node
This was fixed automatically with the change in 2.19.1. See also #541
Just clarifying... it does work now... however:
rollup and webpack (with mainFields set to look at esnext:main along with module, and main) will still hit this issue. If moment.js adds the module field back we will hit this problem.
Most helpful comment
on moment-timezone.js#L14:
should add an interop function call between
factory()and the return ofrequire()something like: