You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem is that {width} sometimes isn't replaced. And I mean sometimes...
Have been struggling with this for a long time and cracked it by accident today while creating this bare-bone example repo to illustrate the problem: https://github.com/joacim-boive/lazysizes-debug
I don't know if the cause is that the already minified file somehow breaks because it's minified again or if I'm doing something stupid — it's probably the latter... ;)
Anyway, using create-react-app as I did in the repo above as well as our home rolled webpack build script has this problem and the solution is NOT to import lazysizes.min.js and instead import the unmodified versions and then everything works.
Maybe this is already stated in the docs, but I just thought I'd mentioned it here as well.
Or, have I implemented it incorrectly somehow?
The text was updated successfully, but these errors were encountered:
@joacim-boive
The reason for this issue is the following: Although lazySizes has one global it supports multiple modules (you can install multiple versions of lazySizes on one site) and all plugins do require lazySizes, which means if you require the minified version you have included lazySizes twice. If the minified version now finds an image the plugins do detect that this is not the version of lazySizes they are bound to and do nothing here.
The best way is that I remove all *.min.js files from future npm.
lazysizes: 4.1.4
react: 16.6.0
The problem is that {width} sometimes isn't replaced. And I mean sometimes...
Have been struggling with this for a long time and cracked it by accident today while creating this bare-bone example repo to illustrate the problem: https://github.com/joacim-boive/lazysizes-debug
I don't know if the cause is that the already minified file somehow breaks because it's minified again or if I'm doing something stupid — it's probably the latter... ;)
Anyway, using create-react-app as I did in the repo above as well as our home rolled webpack build script has this problem and the solution is NOT to import lazysizes.min.js and instead import the unmodified versions and then everything works.
Maybe this is already stated in the docs, but I just thought I'd mentioned it here as well.
Or, have I implemented it incorrectly somehow?
The text was updated successfully, but these errors were encountered: