Closed Alxmerino closed 7 years ago
Hi. Thank you for the feedback! I will look into this as soon as possible. If you come up with a solution for it, feel free to create a pull request.
+1
I get the same error when using require("moment-timer");
moment-duration-format works this way but not moment-timer for some reason. They both have the same general structure so it's hard to figure out the problem at my current skill level.
@SeverinDK @Alxmerino Did you guys find a solution?
It's because this plugin isn't wrap into a 'module' (I mean a module to be usable by require() or import)
Have a look here : https://github.com/umdjs/umd
Probably something like this I guess
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['exports', 'moment'], factory);
} else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
// CommonJS
factory(exports, require('moment'));
} else {
// Browser globals
factory((root.yourPlugin = {}), root.moment);
}
}(this, function (exports, moment) {
// your code here
}));
sorry for the late response guys, I did come up with a response I will post a PR shortly 😄
Hi thanks for building this amazing plugin!
Right now I'm having an issue where I try to import this using Browserify with the ES2015 preset and the plugin is not registering with moment.
This currently doesn't work
This throws a TypeError
I'm using React as well
Thanks!