2

I don't get why adding my custom js file causes below issue. Please help understand the cause. Let me know if more details should be provided here.

Is it dependency issue?

enter image description here

edit: My requirejs-config.js in module

var config = {
 "paths":
 {
 "jQueryCustom": "myVendor_myModule/js/jquery.custom",
 "jqueryNoConflict": "myVendor_myModule/js/jquery.no-conflict",
 }
};

My jquery.no-conflict.js in module

define(['jQueryCustom'],function ()
{
 return jQuery.noConflict(true);
});
asked Aug 3, 2017 at 6:35

3 Answers 3

2

In your custom js you just need to add jquery/ui in require section and it will work.

require(['jquery', 'jquery/ui'], function($){ 
 alert('Test');
});
answered Aug 3, 2017 at 7:20
0

May be it is a jquery conflict issue. Call a custom js via requirejs-config.js instead of xml or phtml file.

Refer below links for using requirejs-config.js

Use require-config.js to load files needed on all pages

Hope it will works.

answered Aug 3, 2017 at 6:42
6
  • Actually I'm adding the js file through requirejs-config.js in my module and calling it in my custom theme phtml file, but I'll check the details with the link you provided... keep here updated Commented Aug 3, 2017 at 6:46
  • please do static-content deploy and clear cache and then check. It may works. Commented Aug 3, 2017 at 6:48
  • I did several times... may you check the edit part, I provided more info. Tnx Commented Aug 3, 2017 at 6:52
  • your code should look like this require(['jquery', 'jquery/ui'], function($){ alert('Test'); }); Commented Aug 3, 2017 at 6:56
  • if you js file you need to include jquery/ui by adding argument in require in your custom js file. Commented Aug 3, 2017 at 6:58
0

calling the js is incorrect. Please define the js like this in phtml

require(['jquery','jQueryCustom'], function($){
// custom codel
 }
Teja Bhagavan Kollepara
3,8275 gold badges33 silver badges69 bronze badges
answered Aug 3, 2017 at 7:03
1
  • That's my jquery.no-conflict.js not the one in phtml file Commented Aug 3, 2017 at 7:05

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.