0

I am trying to add an animation library called Sal, built on pure Javascript (Does not rely on jQuery). Maybe I am missing something, but I followed the instructions on adding via require-config, and I am getting a sal is not defined error.

I have also tried just adding the js file via default_head_blocks.xml

My require-config.js

var config = {
    paths: {
        'sal': 'js/sal'
    },
    deps: [
        "js/script",
        "js/main"
    ]
};

My main.js

define(['sal'], function(){
  "use strict";
  sal();
  console.log(" ====== main.js is loaded====== ");
});
2
  • Please provide info with full module paths. Perhaps you have your js libs in wrong directories ;) Commented May 15, 2021 at 12:26
  • @dudzio perhaps! Here they are: VENDOR/themename/require-config.js VENDOR/themename/web/js/sal.js VENDOR/themename/web/js/script.js (Contains other JS unrelated to Sal) VENDOR/themename/web/js/main.js (Contains my JS and trying to initialize Sal inside) For context, I also importing a slider named Flickity, and it works fine (I didn't include it in my initial example) Commented May 17, 2021 at 5:07

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.