Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [requirejs]

Denotes questions related to require JS. RequireJS is a JavaScript file and module loader. It is optimized for in-browser use, but it can be used in other JavaScript environments.

2
votes
1answer
1k views

Magento 2 : How to Implement Swiper Plugin

I'm trying to convert html template to Magento 2.1.3. I started my conversion using blank-sass from Snowdog. Some CSS was sucessfully implemented but I can't figure out many points. One of them is how ...
2
votes
1answer
13 views

Why isn't Magento 2 recognizing my library in requirejs-config.js?

This is Library location app\design\frontend\user\theme\web\js\owl.carousel.min.js this is my config js file app\design\frontend\user\theme\requirejs-config.js var config = { deps: [ "js/...
0
votes
1answer
1k views

Can Not View Content Blocks due to require.js error - Magento 2 theme change

I am facing problem with require.js on Magento 2 theme change Content > Blocks The page shows endless spinner and I can never view my imported blocks for my new theme. When I do Firebug on the page. ...
0
votes
0answers
14 views

JS Error after adding bootstrap 4.3.1 files in magento 2 custom theme

ERROR Uncaught TypeError: jQuery.ajaxSetup is not a function at jquery-migrate.js:301 at jquery-migrate.js:521 (anonymous) @ jquery-migrate.js:301 (anonymous) @ jquery-migrate.js:521 require....
1
vote
1answer
3k views

Unable to resolve the source file for error in custom theme?

I am working on magento version 2.1.3 and have a custom theme shoppersbay. For some js files it gives error like Unable to resolve the source file for 'frontend/Smartwave/shoppersbay/en_US/...
1
vote
2answers
754 views

Using jquery_lazyload on Magento 2

I tried to use jquery_lazyload on Magento 2 & couldn't get it to work. I loaded it using requirejs-config.js var config = { deps: [ "js/my_script" ], paths: { "LazyLoad": "//cdn.jsdelivr....
2
votes
4answers
820 views

Magento 2 how to define js library

How to define js Library in Magento 2 if I use below method only js is calling var config = { deps: [ "js/main", "js/jquery.min", "js/bootstrap.min" ], paths: { 'jquery' : '...
1
vote
2answers
3k views

Uncaught Error: Mismatched anonymous define() module in magento 2 .?

I have use mCustomScrollbar jquery plugin but there some error have come & error like: Uncaught Error: Mismatched anonymous define() module.. Help appreciated. Thanks. My mCustomScrollbar ...
5
votes
1answer
8k views

Magento 2 add custom validation rule

I'm going crazy here trying to add a custom validation rule to Magento 2. It's impossible to find any useful information about it. The things I have are as follow: 1) requirejs-config.js file with ...
3
votes
3answers
22 views

Uncaught ReferenceError: $ is not defined at pricing.js:122 in magento 2.3.0

Hi am getting an uncought referecne error when adding a custom JS in my theme. On the console I am getting this error- pricing.js:122 Uncaught ReferenceError: $ is not defined at pricing.js:122 My ...
2
votes
0answers
25 views

Magento 2: Remove requirejs in checkout phase

I have a question over Magento 2 checkout phase. I don't want to talk about the decision of force developer to user requirejs knockoutjs and so on... Exist an extension which reproduce the checkout ...
0
votes
0answers
24 views

Override RequireJs Config

So as we all know Magento has always had a massive js overhead, I'm trying to reduce some of this by removing some unnecessary scripts. I know how to override a script or extend one, but how do I ...
0
votes
2answers
226 views

Magento 2.2 some JS files are not loading in production mode

In Magento 2.2.2 when setting website into production mode the following files are not loading, due to which my store switcher and other ui functions are not working in production mode: http://...
2
votes
3answers
1k views

Magento 2 : Add custom js to a single CMS page

I am trying to add custom js to a single CMS page in Magento 2.2.5. Here is what I got: I have put the rellax.min.js file at :/app/design/frontend/TemplateMonster/md/web/js And I want to use that ...
3
votes
1answer
586 views

RequireJS components sometimes not loading

We are launching a Magento 2.1.3 site, and finding that the site will sometimes load all of its Javascript components and dependencies properly, but sometimes fails to load, in which case a slider is ...
1
vote
2answers
71 views

How to get data-mage-init config in our custom magento jquery widget?

I am currently creating custom jquery widget for owl-carousel just to learn how to do it properly in magento-2. I have configured my own module in requirejs-config.js at theme level. var config = { ...
0
votes
2answers
30 views

Loading external JS using requireJS in Magento2

Following this answer I try to add an external JS file named Pym.js to my Magento 2.3 shop. I've tried several things but can not get it to work. My current setup it: app/design/frontend/vendor/...
0
votes
1answer
564 views

How to override _UpdatePrice function in vendor\magento\module-swatches\view\frontend\web\js\swatch-renderer.js

in my app\code\X\Y\view\frontend\requirejs-config.js I have: var config = { map: { '*': { 'configurable':'X_Y/js/configurable', 'swatchRenderer':'X_Y/js/...
0
votes
0answers
6 views

Masonry with ImagesLoaded and InstagramFeed

So i am trying to implement Masonry to Mageplaza InstaFeed Widget into a CMS page, but the code generated by the feed do not get Masonry working. Since If I copy the generated code once again into the ...
1
vote
0answers
23 views

Require JS error mime(text/html) not supported

I have just installed magento with composer and I am facing require js errors in my javascript console and the page in blank. no features are exposed
0
votes
1answer
611 views

How to call a js method in my template with RequireJS in Magento2?

In vendor/magento/module-catalog/view/base/web/js/price-options.js there is a method _onOptionChanged: function onOptionChanged(event). I would like to call this method in my template when page load. ...
1
vote
3answers
718 views

magento 2 How to override module-configurable-product configurable.js file

I want to override following js core file. public_html/vendor/magento/module-configurable-product/view/frontend I have tried in my custom theme as follow but it is not working public_html/app/...
2
votes
1answer
58 views

How to pass variable from phtml and how to get variable in require js file

How to pass parameter form .phtml to require js file Template file <script type="text/javascript"> require(['Namespace_Module/js/custom'], function () { }); </script> JS ...
1
vote
1answer
44 views

Uncaught Error: Mismatched anonymous define() magento 2.2.4

Below is the console erros is getting in frontend. Checked .htaccess in pub, pub/static and root all .htaccess are identical to Magento 2.2.4 version. js bundling/minification is enabled and ran ...
0
votes
0answers
36 views

Custom JavaScript without RequireJS

Is it possible to add custom JS to Magento 2, without RequireJS while avoiding render-blocking problems? This error keeps coming: http://requirejs.org/docs/errors.html#mismatch That error ...
3
votes
1answer
914 views

Magento 2 custom module override knockout template

How can we override a knockout template in a custom module? I know how we can do this in our own theme but I need this in a module. For example I like to override this file: vendor/magento/module-...
0
votes
1answer
37 views

Magento 2 Stuck on Checkout page

I am using magento 2.2.3. And my issue is, on frontend I am getting below errors which stucks checkout page. Means, Page Loader is continuosly loading on checkout page so customer can not do anything :...
8
votes
3answers
2k views

Magento 2 - How to apply Slick Slider to Recently Viewed Widget

I have created a code but slider is not showing up in recently viewed products. Here is my code - I have downloaded slick js and css from the following link http://kenwheeler.github.io/slick/ Then ...
1
vote
0answers
22 views

Google Chrome is failing in loading require.js files in time

On Magento 2 (ver 2.2.5), with Google Chrome (ver 72.0) I'm getting a wired error I wasn't getting withe previous Google Chrome version (ver 71). When I visit a product page, I get more then one ...
0
votes
1answer
19 views

How can I use Highcharts graphs in magento2 custom module customer account section in the standard/recommended way with require js?

I need to use the Highcharts.com simple line graph by adding its library with requirejs-config.js in frontend luma theme, custom module in customer account section. I have tried these solutions but ...
5
votes
3answers
721 views

Custom javascript not working

I'm trying to inject a scroll to anchor javascript globally in Magento 2. More specifically this script: $('a[href^="#"]').on('click', function(event) { var target = $(this.getAttribute('href'));...
1
vote
1answer
59 views

How to use owl carousel using require js in magento 2

Anyone can help me out how to use owl carousel using a custom theme by using require js I have downloaded owl carousel zip file from an official website. I want to use this owl carousel in my block ...
0
votes
1answer
48 views

Magento 2 : Use of shims in requirejs-config.js file

Can anyone explain me what is the use of shims dependencies in requirejs-config file? Doing much of research but I hasn't found exact answer for this.
3
votes
0answers
24 views

js not loading properly in backend product edit while click on show/hide of description field magento 2.2.4 production mode

This issue specific to production mode of Magento 2.2.4. Js is appending in product edit url like : base_url/admin/catalog/product/edit/id/57473/set/12/key/...
0
votes
1answer
634 views

Magento 2: Global variable doesn't work with RequireJS

I'd create a HTML document with a script tag and add this URL <script src ="https://assets.pagar.me/pagarme-js/3.0/pagarme.min.js"></script> so, call the global variable pagarme in ...
2
votes
4answers
2k views

Magento 2: How to override core js module price-bundle.js

I am attempting to override the _onQtyFieldChanged event in the mage.priceBundle widget in the module-bundle/view/base/web/js/price-bundle.js file. I am referencing the Magento dev docs (http://...
1
vote
2answers
678 views

Magento2: use Modernizr in my custom theme

I am developing a custom theme in Magento 2.1. I am writing some custom javascript functionalities and I need to use Modernizr. How to I include it in my custom theme? This is my javascript code: ...
1
vote
0answers
25 views

how to rewrite magento2 backend menu js

I want to rewrite magento2 js The file path is "vendor/magento/theme-adminhtml-backend/web/js/theme.js", what should i do? Thanks for you helping
2
votes
0answers
25 views

I have added js using require js but it is not attached

I have added javascript files in require js but it is not showing in the inspect element that my javascript files are attached and it is not working. What should I do? I have cleared cache and folders ...
1
vote
1answer
45 views

Magento2 : Using RequireJS module conditional of whether it exists

It is possible to use RequireJS to inject some modules into a custom script, for example: define([ 'jquery', 'tinymce', 'Magento_Ui/js/modal/modal' ], function($, modal, tinymce) { "...
1
vote
1answer
733 views

Magento 2: Adding external CSS and JS to only one content page, and use jquery functions inside the content

I am trying to add some dynamic function to one content page of a Magento 2 site, but didn't manage to do it. Here is what I thought: 1) Adding the external javascript files at the "Layout Update XML"...
0
votes
2answers
498 views

How do I extend Magento_Checkout/js/checkout-data.js?

How do I extend Magento_Checkout/js/checkout-data.js in a custom theme?
1
vote
1answer
773 views

Magento 2:- How to create Vertical or Horizontal tagging with Tabs widget

I tried to create tabbing using Tabs widget but It does not display what i want. I follow this Link:- Tab widget and Building Tabbed Interface with Magento 2 Javascript UI Widget/Modal/view/frontend/...
0
votes
1answer
55 views

Magento 2 : How to fire custom ajax before add to cart ajax fire in product detail page?

I have created custom extension and how to fire custom ajax before add to cart ajax fire in product detail page from my custom module. I don't want to override js in theme level. please suggest any ...
1
vote
1answer
53 views

Magento 2 : How to put custom text in form validation?

I have this message when i validate post code How to change it? I tried overriding postcode-validator.js define([ 'jquery', 'mageUtils', 'Magento_Ui/js/model/messageList'], function ($, utils, ...
2
votes
0answers
27 views

Magento 2.2 x or 2.3 - to bundle or not to bundle

I've read so many conflicting write up's and blogs about whether to "Enable Javascript Bundling" or not. Some say it's slow and some say it's faster when enabled. From what I understand it takes all ...
5
votes
2answers
655 views

How to trigger self.openFullScreen() function into my custom jQuery in Product details page

If we click on product image in the product details page, gallery full screen is coming to see the images in full screen. I am trying to get the same functionality when click on my string Quick view ...
2
votes
0answers
90 views

Uncaught TypeError: $.initNamespaceStorage is not a function magento2

Some functionality is not working properly and it shows some errors in console Any help will be appreciated.
0
votes
1answer
27 views

Windows separator issue when upgrade Magento from 2.2.5 to 2.3

ERROR: Invalid template file: 'C:/xampp/htdocs/Project/vendor/magento/module-theme/view/frontend/templates/page/js/require_js.phtml' In module: '' block's name: 'require.js'
0
votes
1answer
769 views

jQuery version update at M2

I want to upgrade magento 2 jQuery version from 1.9 to 3 do you think is an good idea? how i do it for upgrade jquery build-in file who come with magento 2 ?