-
Notifications
You must be signed in to change notification settings - Fork 478
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
Uncaught TypeError with RequireJS #22
Comments
It appears when using requireJS, It seems that FastClick is not maintained very well, seeing their issues and pull requests, so I won't bother to fix that for them. I'll find an alternative to use and replace this dependency. Until then, apply some temporary fix so that the |
looking forward for requireJs |
Hi, any updates on this? Some more info on how to apply the temporary fix will be very useful. I am trying to use this on a backbone project. Thanks for the library. |
@chandra-sekar
Few lines below, change this if statement from if (typeof define !== 'undefined' && define.amd) {
// AMD. Register as an anonymous module.
define(function() {
'use strict';
return FastClick;
});
} to if (typeof define !== 'undefined' && define.amd) {
// AMD. Register as an anonymous module.
module.exports = FastClick.attach;
module.exports.FastClick = FastClick;
} Not the prettier solution but it works. |
@ingro |
+1 for a permanent fix, editing the file all the time is a pain |
@abpetkov What happens is the following:
When your code uses FastClick as a Component module, it concatenates this code as part of the FastClick module. When this code runs in a RequireJS environment, it defines a RequireJS anonymous module, but the file name is switchery.js and not related to fastclick, so RequireJS gets totally confused. Do you have any direction on how to approach fixing this? I know this is not directly related to Switchery. |
+1 for requirejs support |
It looks like this problem is still there, it's just not working with Webpack, still no permanent solution without editing packages file for this? |
define() is being invoke multiple times:
|
Switchery is not working for me when using RequireJS (v2.1.10).
It seems the problem is present since the introduction of FastClick library.
In console I get "Uncaught TypeError: object is not a function" at line 1311, doing some debugging I see that fastclick var is an empty object.
I've uploaded an example:
Preview: http://bl.ocks.org/fabiocaseri/8956655
Gist: https://gist.github.com/fabiocaseri/8956655
The text was updated successfully, but these errors were encountered: