Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatible with r.js optimizer #6

Open
jpuffer opened this issue May 6, 2016 · 2 comments
Open

Incompatible with r.js optimizer #6

jpuffer opened this issue May 6, 2016 · 2 comments

Comments

@jpuffer
Copy link

jpuffer commented May 6, 2016

Cannot be used with projects which productionize using Requirejs's built in optimizer. The following error in the optimized version:

require.js:1Uncaught Error: Module name "moment" has not been loaded yet for context: _. Use require([])
http://requirejs.org/docs/errors.html#notloaded
   makeError                @   require.js:1
   f                        @   require.js:1
   requirejs                @   require.js:1
   (anonymous function) @   moment-round.js:3
   (anonymous function) @   moment-round.js:55
@WebDevTmas
Copy link
Owner

I'm sorry but I'm really busy these weeks and have no time to get it fixed.
But I believe the round method has been implemented natively in momentjs now?

@jpuffer
Copy link
Author

jpuffer commented May 27, 2016

Nope, Moment still references your plugin in the official docs http://momentjs.com/docs/#/plugins/round/
Not a big deal though, I just made a copy of the plugin and changed the first two lines to
define(function(require) {
'use strict';
var moment = require("moment");
and deleted .call(this); from the end.

That fixed it for me. I would PR but I'm guessing this ruins the whole thing for regular non-module use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants