cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2 theme JQuery stops working after installing module

SOLVED
   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

Re: Magento 2 theme JQuery stops working after installing module

I followed your steps again and I'm afraid it did not solve the problem... I think the problem is the new module?

 

If I restore a back-up before I installed the module I get no errors but after installing it the exception log shows.

 

main.CRITICAL: Unable to get content for 'frontend/Smartwave/porto_child/en_US/Vendor_Module/js/vendormodule.js

 

Do you have any ideas for this?

Re: Magento 2 theme JQuery stops working after installing module

@Rakesh Jesadiya @gelanivishal

 

It seemed gelanivishal's solution just worked for me! I had to do the following commands after the require-config.js file.

 

php bin/magento setup:upgrade

php bin/magento setup:di:compile

php bin/magento setup:static-content:deploy -f

php bin/magento c:c

php bin/magento c:f

 

Thank you guys for your time

 

Re: Magento 2 theme JQuery stops working after installing module

Hello @gelanivishal
I have the same js errors in my console, to fix these errors I have added the code which you have shared, Now I am not getting those errors but by fancybox is not working. Getting "Fancybox library is not loaded" this error in console. To fix this fancybox error I have added fancybox in my requirejs-config.js file. Still It is showing me same error and my quickview popup is not working.  Please review my code and please guide me to fix this issue.

var config = {
    shim: {
        jquery: {
            exports: '$'
        },
        'Smartwave_Megamenu/js/sw_megamenu': {
            deps: ['jquery']
        },
        'owl.carousel/owl.carousel.min': {
            deps: ['jquery']
        },
        'js/jquery.stellar.min': {
            deps: ['jquery']
        },
        'js/jquery.parallax.min': {
            deps: ['jquery']
        },
        'fancybox/js/jquery.fancybox': {
            deps: ['jquery']
        }
    }
};
        

Re: Magento 2 theme JQuery stops working after installing module

I have Applied given solution worked in mozialla but in firefox it gives error for fotorama.js

I have added it in reaquire-config.js but not working.


@gelanivishal wrote:

Hello @m_w1,

 

create a requirejs-config.js in the root of the child theme

app/design/frontend/Smartwave/porto_child and put in the following:

 

 

var config = {
    shim: {
        jquery: {
            exports: '$'
        },
        'Smartwave_Megamenu/js/sw_megamenu':
            {
                deps: ['jquery']
            }, 
        'owl.carousel/owl.carousel.min':
            {
                deps: ['jquery']
            },
        'js/jquery.stellar.min': 
            {
            deps: ['jquery']
            },
        'js/jquery.parallax.min':
            {
            deps: ['jquery']
            }
    }
};

 

And change the entries:

 

<script src="jquery.js" />
<script src="bootstrap/js/bootstrap.min.js" />
<script src="fancybox/js/jquery.fancybox.js" />

To:

 

 

<remove src="jquery.js" />
<remove src="bootstrap/js/bootstrap.min.js" />
<remove src="fancybox/js/jquery.fancybox.js" />

Within file:

app/design/frontend/Smartwave/porto_child/Magento_Theme/layout/default_head_blocks.xml
No more need for merging javascripts, no more javascript errors! I have no need for the fancybox, turned it off, but if you do require it, I guess it should be included in the requirejs as well.

 

Let us know if you get trouble with it.

 

 

 

--
If you've found one of my answers useful, please give "Kudos" or "Accept as Solution"