cancel
Showing results for 
Search instead for 
Did you mean: 

RequireJS loading JS file from the wrong folder

RequireJS loading JS file from the wrong folder

This is the requirejs-config.js from the Magento Theme that I am using.

I am trying to add mixitup and magnific js libraries so I can run the javascript on the page itself.

But when I execute the static deploy, requirejs is trying to load the js files from the static folder and not from the child Sm_Market folder.

var config = {
    map: {
        '*': {
            jquerypopper: "Sm_Market/js/bootstrap/popper",
            jquerybootstrap: "Sm_Market/js/bootstrap/bootstrap.min",
            owlcarousel: "Sm_Market/js/owl.carousel",
            jqueryfancyboxpack: "Sm_Market/js/jquery.fancybox.pack",
            jqueryfancyboxmedia: "Sm_Market/js/jquery.fancybox-media",
            jqueryunveil: "Sm_Market/js/jquery.unveil",
            yttheme: "Sm_Market/js/yttheme",
mixitup: "Sm_Market/js/jquery.mixitup.min",
magnific: "Sm_Market/js/jquery.magnific-popup"
        }
    },
    shim: {
        'jquerypopper': {
            'deps': ['jquery'],
            'exports': 'Popper'
        },
        'jquerybootstrap': {
            'deps': ['jquery', 'jquerypopper']
        },
'mixitup': {
            'deps': ['jquery']
        },'magnific': {
            'deps': ['jquery']
        }
    },
    config: {
        mixins: {
            'Magento_Swatches/js/swatch-renderer': {
                'Sm_Market/js/swatch-renderer-mixin': true
            }
        }
    }
};
6 REPLIES 6

Re: RequireJS loading JS file from the wrong folder

Hi @justinrcho009f ,

 

Your Js files should be load from the static folder only from below path

pub/static/{frontend/adminhtml}/{Theme_vendor}/{Theme_Name}/en_Us/Sm_Market/js/

jquery.mixitup.min.js
jquery.magnific-popup.js

 

Please let me know what path you are getting and also mention the path where you have added these Js files in the theme.

 

Thanks!

----------------------------------------

Problem solved? Give Kudos and Click Accept as Solution!

 

 

Re: RequireJS loading JS file from the wrong folder

RequireJS is expecting the file path to be

/pub/static/frontend/Sm/market/en_US/mixitup.js

/pub/static/frontend/Sm/market/en_US/magnific.js

 

but the 2 files are located in 

/pub/static/frontend/Sm/market/en_US/Sm_Market/js

 

So I have been copying and renaming them manually.

 

Re: RequireJS loading JS file from the wrong folder

Hi @justinrcho009f ,

 

There is little confusion, can you please specify what js path you need and what we are getting right now. So that we can check for the solution in the right direction.

 

Thanks!

Re: RequireJS loading JS file from the wrong folder

The files after running static deploy is here

/pub/static/frontend/Sm/market/en_US/Sm_Market/js

 

But RequireJS is looking for the files here 

/pub/static/frontend/Sm/market/en_US

with different filenames.

Re: RequireJS loading JS file from the wrong folder

I am facing the same issue, Any solution you found?

Re: RequireJS loading JS file from the wrong folder

Redeploy if it's the wrong path.

 

Rerun

setup:upgrade

setup:deploy:content