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

respimg "UMD" pattern faulty #470

Open
emkayy opened this issue Feb 20, 2018 · 2 comments
Open

respimg "UMD" pattern faulty #470

emkayy opened this issue Feb 20, 2018 · 2 comments

Comments

@emkayy
Copy link

emkayy commented Feb 20, 2018

The new module pattern doesn't work for AMD.
To be honest, I don't know how it's supposed to work. It looks a lot more complicated than a regular UMD pattern.

However, it seems like

} else if(typeof module == 'object' && module.exports){
	factory(require('lazysizes'), require('../fix-ios-sizes/fix-ios-sizes'));

can't work. I'm working with requirejs optimizer and there you'd need to test for something like

if (typeof define === 'function' && define.amd) 

In IE11 I get the error Unable to get property 'aC' of undefined or null reference

@emkayy
Copy link
Author

emkayy commented Feb 20, 2018

And I guess you would have to call factory rather like this:
define(['lazysizes', '../fix-ios-sizes/fix-ios-sizes'], factory);
... if I'm not mistaken?

@emkayy
Copy link
Author

emkayy commented May 15, 2020

Hi there,

I came across the same issue again :) Whereas the main lazysizes-umd.js respects AMD modules, the plug-ins don't.

Could you please add the following to the plug-ins as well:

	} else if (typeof define == 'function' && define.amd) {
		require(['lazysizes'], factory);

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

1 participant