Saturday, 1 May 2021

Lazyload polyfill / Magneto 2 js error "loading-attribute-polyfill.js Uncaught ReferenceError: module is not defined"

I am trying to load this lazyload polyfill script into my Magneto 2 project.

The code works but there is a console error I am trying to fix and having no luck.

Chrome console: loading-attribute-polyfill.js Uncaught ReferenceError: module is not defined at loading-attribute-polyfill.js:263

Safari console: ReferenceError: Can't find variable: module

I have tried loading it in the head via xml, manually before end in a phtml template, and also through requirejs-config.js, all give the same error.

In case it matters I was loading it via requirejs like this:

var config = {
    deps: [
      "js/vendor/loading-attribute-polyfill"
    ],
    map: { ... } 
};

Has anyone implemented this script into magento 2 without this error? Is there a manual edit I can make to the script to workaround this?

Cheers!!

enter image description here



from Lazyload polyfill / Magneto 2 js error "loading-attribute-polyfill.js Uncaught ReferenceError: module is not defined"

No comments:

Post a Comment