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
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
0answers
13 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....
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 ...
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 ...
1
vote
2answers
70 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
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 ...
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/...
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 ...
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 :...
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 ...
5
votes
3answers
716 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 ...
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
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 ...
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/...
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
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
44 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) { "...
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 ...
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 ...
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
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
24 views

my 2.2.6 magento checkout page do not display firstname,postcode,and telephone input field

My current version is magento 2.2.6 and i am facing a strange issue. My checkout page do not display firstname,postcode,and telephone input field on checkout page. whenever i try to place order ...
0
votes
1answer
43 views

map js url not loading magento2

we have a site that was running fine, we just move site to new instance and got an error. All js file's map urls, that we define in require-config.js file not loading on frontend. Like, we define - ...
0
votes
1answer
49 views

Requirejs-config.js not working for parent theme's responsive.js file

I would like to change the values for the media property for the files menu.js & responsive.js from media: '(min-width: 768px)' to media: '(min-width: 992px)'. I thought using Magento's JS Mixin ...
0
votes
0answers
35 views

Custom live chat script not working in Magento 2.2.4

I have tried adding the chat script on .phtml of the custom extension which I have created for integrating my own live chat. But the libraries are showing undefined when the chat plugin loads the ...
0
votes
2answers
60 views

How to hide particular admin form field(UI Component) based on the value of select field?

I used the following script to hide/show 'schedule_date' based on select field option change, and it is working fine. But I want to hide/display the fields without changing the select field options. ...
0
votes
1answer
21 views

Magento 2.1.9 - Cannot seem to overwrite JS comonent template in custom module

Having trouble trying to overwrite a JS component template at checkout. Here is my module structure and code for this specific task: app/code/MY/MODULE/view/frontend/layout/checkout_index_index.xml &...
0
votes
1answer
58 views

Use of non-amd jquery plugins with requirejs without modifying them?

I recently searched a lot on use of non-amd jquery code with requirejs but couldn't find a proper way to do it. To be more specific, I want to use pana-accordion.js found at below mentioned url. ...
0
votes
1answer
42 views

How to create auto call javascript multiple function in magento 2 in single file

I create two js file for a task. I want to merge two file task in one file in three function. Both two have different config parameter. I am using magento x init. <script type="text/x-magento-init"...
1
vote
2answers
37 views

Having trouble overwriting JS component in minicart dropdown

Having a tough time trying to overwrite the JS component and template around the product image in the minicart dropdown.Here's what I am trying to achieve: I have a custom Product Type depending on ...
1
vote
2answers
86 views

Module JS - Mismatched anonymous define module

I've tried adding my module JS file to Magento2 but for whatever reason it seems to return this error: Error: Mismatched anonymous define() module: function($) My view/frontend file structure: |-...
0
votes
2answers
161 views

Magento 2 How to override adminhtml Js components

Basically I want to override grid.js component file in Magento 2 Require config view/adminhtml/require-config.js Require config code. var config = { map: { '*': { ...
1
vote
0answers
12 views

Created node doesn't have attachEvent property

After updated magento from 2.1 to 2.3 I've got a require js error in console: Uncaught Error: Script error for: ModuleName I made an investigation and find out that require.js core file in the ...
1
vote
1answer
75 views

jquery plugin error “Uncaught TypeError: $(…).[plugin function] is not a function”

I am using Magento 2.2.6 and I am trying to include a jquery plugin (stickybits, in this case). The jquery plugin file is successfully called in my requirejs-config.js file and I can see that the file ...
0
votes
0answers
150 views

Magento 2 how to write in data-mage-init

Magento uses below way to show Requistition list using "x-magento-init". <div class="block block-requisition-list social-button" data-bind="scope: 'requisition_ - 111'"> <!-- ko template: ...
0
votes
0answers
13 views

Integrating Magicsearch(autosearch) plugin into Magento 2 but getting Magicsearch JS error in console

I'm integrating "jQuery Magicsearch" plugin into Magento 2,you can get Magicsearch plugin from here:- https://www.jqueryscript.net/form/Dynamic-Autocomplete-Multi-select-Plugin-With-jQuery-...
0
votes
1answer
180 views

Trying to override magento2 product view breadcrumbs

So i tried to change the breadcrumbs.html JS template for magento 2.3 product view breadcrumbs in <themedir>/Magento_Theme/web/templates/breadcrumbs.html, but ive been stuck on this for half a ...
2
votes
1answer
208 views

Fresh Magento 2.3 Resource Files Not Working After Installed in Windows

Fresh Magento 2.3 installed in windows, after resource check and completed everything successfully installed, then if i open my website i am getting error like,
1
vote
1answer
25 views

Require.js errors after database restore

On Magento 2.2.6 I restored from an earlier database. After doing that I flushed the cache, reindexed the site,and deployed static content. I now get require.js errors on every page. On my category ...
1
vote
0answers
28 views

How to add a configurable external JS with additional data- attributes via requirejs?

I was trying to add an external JS, say https://foo.bar/script.js (the url is configurable via config data) via requirejs, and I was successful so far. But then I realized that I would need to provide ...
0
votes
1answer
122 views

How to Load JS Code at the Top Using RequireJS

How can I load a custom JavaScript file using RequireJS at the very beginning? Please note: The key is that RequireJS must load my script FIRST, before any other scripts, as the rest of my script ...
0
votes
0answers
62 views

Remove calendar.js only from Magento 2 default homepage?

Do I want to Remove calendar.js from Magento 2 luma theme homepage? If I remove require.js from custom module it removes calendar.js and other all. Also, Can I remove the mapping of calendar.js from ...
1
vote
1answer
42 views

Adding JS to theme [duplicate]

I've seen a few similar posts on the Magento SE but none seem to work for me. I'm probably missing something but I for whatever reason my JS is not being included. I have a theme app/design/...
0
votes
0answers
35 views

Magento 2 EE : Override configure function(addbysku.js) of Magento_AdvancedCheckout module using mixins

In addbysku.js file, I want to override the configure function of Magento_AdvancedCheckout module using mixins in Magento Enterprise Edition. And my js code is, define([ /* eslint-disable strict */ ...
0
votes
1answer
319 views

Magento 2: Cannot read property 'dialog' of undefined, 'timepicker' of undefined,'RFC_2822' of undefined

Sometimes I'm getting following errors in the console after reloading the page:- Cannot read property 'dialog' of undefined Cannot read property 'timepicker' of undefined Cannot read property '...
0
votes
1answer
60 views

Can't add custom script (leaflet) to Contact page

I'm trying to add a map in Contact page. In order to do that,I did the following: In file: app/design/frontend/MyCompany/MyTheme/Magento_Contact/layout/contact_index_index.xml I added: <page ...
4
votes
2answers
364 views

Magento 2 : How to call text/x-magento-init on Ajax success

I am in need to trigger some script with "text/x-magento-init" on ajax call but I am unable to do so. trigger('contentUpdated') contentUpdated is also not working in my case. I am using ...