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.

Filter by
Sorted by
Tagged with
0 votes
1 answer
39 views

Magento2 | Reduce JS files to optimize site performance

I am trying to figure out how I can exclude some js files that Magento2 loads and makes it so heavy however without compromising the functionality of the site. On my site with Magento2 I have a lot of ...
Jackom's user avatar
  • 473
2 votes
0 answers
36 views

How to integrate Google Pay library into website?

I'm trying to integrate Google Pay into my Cart page. But, I always get an error, it looks like this: Uncaught Error: Script error for "https://pay.google.com/gp/p/js/pay.js" https://...
Nguyễn Hoàng Tuấn's user avatar
0 votes
1 answer
58 views

How to prevent user sending requests frequently?

I believe it can be done with a PHP controller or JS cookie manipulation. Help me with logic. For example, I want a user to send a request once every 2 minutes. Let's pretend I've implemented some ...
Dramorian's user avatar
0 votes
0 answers
76 views

bootstrap.min.js:7 Uncaught Error: Bootstrap tooltips require Tether

I am using Magento 2.4.5 and I'm working on jquery. I load some minified js files including bootstrap 4 alpha 6 and tether.min.js but facing some errors in loading tether.min.js. Please help if anyone ...
varneet's user avatar
0 votes
0 answers
133 views

Caught TypeError: self.AnyFunction is not a function

I am trying to modify the default Magento 2 Checkout, basically I want to remove the "Payment and Review" step and put them all together. Everything goes well but I have stuck intro an issue....
George George's user avatar
2 votes
0 answers
327 views

Magento 2 : Codazon Fastest Theme js not loading propperly

I Have Installed Codazon Fastest Theme on my Manto2 site.i am facing an issue with js loading. here is my system configuration below. magento version : 2.4.5 PHP: 8.0 theme: Codazon Fastest Theme ...
sandip memariya's user avatar
0 votes
2 answers
193 views

How & where is magento javascript initialized on "DOM ready"?

The docs for initializing JavaScript state: On DOM ready, the data-mage-init attribute is parsed to extract component names and configuration to be applied to the element. Where does this "DOM ...
Timothy Fisher's user avatar
0 votes
0 answers
36 views

Magento Js Override another Js File (which is already overriding a Magento Core js)

I need to overwrite a third party module js with my own one. I read in many articles which map is the way to do it. Foodentyco_Checkout/js/model/shipping-rate-service-override has to override ...
Nicola Lo Surdo's user avatar
0 votes
1 answer
281 views

can anyone find out the error in this knockout js code

this is phtml file located in Namespace_ModuleName/view/adminhtml/templates/js_time.phtml <div> <h4>Current Time is:</h4><span id="time_show" data-bind="text: ...
mrshiam's user avatar
  • 15
0 votes
3 answers
982 views

Override js widget variable using mixin

I'm trying to override a widget variable using mixin , but I get the following error Uncaught TypeError: target.extend is not a function the original file is define([ "underscore", &...
Anass Hl's user avatar
0 votes
1 answer
50 views

Magento 2 - Two scripts have method with same name, how to call one specific of them

Situation The method "test" does exist two times. If I call it while both scripts are required, then only the last one is getting called e.g. the one from test2.js app/code/Company/Test/view/...
Black's user avatar
  • 3,280
3 votes
2 answers
7k views

Uncaught Error: Mismatched anonymous define() module

I'm trying to use jquery in an adminhtml js file...but it seems not to be working and can't get to understand why...any help would be appreciated ! Layout is like <head> <script src="...
Claims's user avatar
  • 1,146
0 votes
1 answer
390 views

How can I resolve the JavaScript error after upgrade magenta from M 2.4.3 to 2.4.5 in Magento 2??

Here I upgrade Magento from 2.4.3 to 2.4.5 so getting a javascript error can anyone help me how can I resolve this error? Can not find out what excatly issue
Jay Parmar's user avatar
0 votes
1 answer
255 views

Magento 2 Should I use multiple require js inside a phtml file?

I need to use require js to use jquery in my block. Do I have to declare for each function require JS at each beginning or there is a way to declare it only once? here is my code, thanks my html <...
kevin richard's user avatar
1 vote
1 answer
154 views

Magento 2: Use of map in RequireJs-config

Is anyone know the use of this 'custom' & when we need to use that? var config = { map: { **'custom':** { '@@@': '@@@', '@@@': 'js/@@@' ...
Dhaval Vaghela's user avatar
0 votes
0 answers
133 views

How to change the LESS variables using javascript based on the admin side configurations?

I am Naveen raj, and I am a new Magento 2 so I don't know how to use the color values inside the less which I got from the admin side. I got value from the admin side and am trying to set that value ...
Naveen Raj Kumar's user avatar
0 votes
1 answer
187 views

How to add a JS library and a JS script that makes use of that library?

I'm trying to use Chroma library in Magento and so far I did the following two things: Created a app/design/frontend/Vendor/Theme/requirejs-config.js with the following content: var config = { deps: ...
Захар Joe's user avatar
0 votes
1 answer
590 views

change jsLayout html template

How can i change the jslayout html template to be phtml so i can call other blocks in it? first i have requirejs-config.js below code var config = { "map": { "*": { ...
Bayzel's user avatar
  • 187
0 votes
1 answer
1k views

Component sometimes not loading - "Failed to load the "Vendor_ModuleName/js/view/minitest" component in Magento 2

We are launching a Magento 2.4.2 site, and finding that the site will sometimes load all of its Javascript components and dependencies properly, but sometimes fails to load on the custom component. In ...
vVin's user avatar
  • 36
2 votes
2 answers
2k views

A lot of js.map file not found after upgrade to Magento 2.4.3

I just upgraded my magento version to 2.4.3-p1, and after i login to the admin site there are a lot of js.map file not found in the console log message: How can i resolve this issue ?
blue's user avatar
  • 128
0 votes
2 answers
45 views

How to use Jquery lib in Magento 2

Platform: Magento2 I want to import and use 3nd Jquery library in my module. Eg: https://www.jqueryscript.net/other/SEO-friendly-jQuery-Infinite-Scroll-Plugin-Clever-Infinite-Scroll.html use to create ...
Nhat Lich's user avatar
0 votes
1 answer
364 views

How to avoid JS minification in an external file add via requirejs-config.js?

I have a custom module called Quicklink it has its own JS files and external JS files too, I've added an external JS from a third-party CDN, but when I enable the JS minification in a Magento 2 clean ...
Rafael Corrêa Gomes's user avatar
0 votes
0 answers
610 views

console error:Uncaught TypeError: require.config is not a function in magento2

Uncaught TypeError: require.config is not a function at requirejs-config.js:18 at requirejs-config.js:19 at requirejs-config.js:757 (anonymous) @ requirejs-config.js:18 (anonymous) @ ...
Sonali Ghule's user avatar
0 votes
3 answers
677 views

Magneto 2 : how to call code in require js

How to write code in require js, I created layout default.xml file and added code like this <link src="Test::js/custom.js"/> And I created web/js/custom.js and wrote like this ...
User0434's user avatar
  • 1,155
0 votes
1 answer
202 views

Add Fancybox in Magento 2.4.3

First, I added these files to my custom theme: app/design/frontend/Custom/mytheme/web/js/jquery.fancybox.min.js app/design/frontend/Custom/mytheme/web/css/jquery.fancybox.css Then I edited app/...
zekia's user avatar
  • 620
0 votes
2 answers
652 views

Magento 2 Js files are not loading from pub/static in my custom module

Magento 2 Js files are not loading from pub/static in my custom module Js file path as: app/code/vendor/name/view/adminhtml/web/js/grid/columns/thumbnail.js Even above file is available in static/...
Zahid Hussain Magento's user avatar
0 votes
1 answer
80 views

Detect IE11 browser and show cms block modal with phtml script tag

I have a modal that pops up when the site detects it's on IE11. The modal is in a cms block so that the client can edit it. I have created a reference container with a custom phtml and put the script ...
totneschap's user avatar
0 votes
1 answer
117 views

Magento 2.4 Admin Invoice Does Not Render Properly - uncaught reference error: require is not defined

Magento 2.4.2 admin invoice does not render the CSS on certain invoices - the page shows up without any styling. (Some older invoices do still render properly as they should). So it seems that the ...
Ray's user avatar
  • 43
2 votes
2 answers
164 views

Magento 2 - New Tax rule page showing "require is not defined" error in console

When I try to add new tax rule I am getting "require is not defined" error in console which cause properly loading issue for Tax Rate, Customer Tax Class and Product Tax Class field (see ...
Nayem323's user avatar
  • 741
1 vote
0 answers
30 views

Magento 2 - Load data from store instead of hardcoding

I am creating a new tag programmatically and append it to the DOM. Currently I hardcoded the phone number, because I don't know exactly how I can load it from the store by using javascript. This is my ...
Black's user avatar
  • 3,280
2 votes
1 answer
2k views

how to create a mixin js in magento

in my case i want to add a mixing for just a single line but i can't achieve that the parent js file is ==> web/vendor/magento/module-customer/view/frontend/web/js/model/customer/address.js /** * ...
mage's user avatar
  • 23
0 votes
2 answers
630 views

add js file to catalog page magento 2

I am using Magento 2.2.1. I want to add a js file to change one special span tag content with CSS class "price" on the catalog page. I was using document.getelementnByClass.. for my js ...
sina Dabbagh's user avatar
0 votes
2 answers
1k views

How to load slick carousel , or any other js file into magento 2?

I'm trying to load the slick carousel into my magento theme and it generates a huge error: "Uncaught Error: Mismatched anonymous define() module". I think it must be related to require js, ...
lucas's user avatar
  • 309
1 vote
1 answer
83 views

How to add JS file reference in a custom JS file

In a custom module view/frontend/web/js folder I have 2 JS files: jquery.custom.js registration.js In the XML layout file of the module, I have: <head> <link src="Vendor_Module::js/...
jstuardo's user avatar
  • 609
4 votes
0 answers
155 views

How to use Youtube Player API with jQuery in in Magento 2?

I'm using Magento 2.4 and i'm trying to use Youtube player API with jQuery in Magento 2 .phtml file like this first: <script> require(['jquery'], function($){ var tag = document....
Padawan's user avatar
  • 135
1 vote
2 answers
866 views

Swagger Looks Empty Magento 2.4.2

I had updated the Magento 2.3.5 to Magento 2.4.2 the my Swagger is not working i shows the Empty page. The console shows some error and there is a syntax error in swagger like it is showing but i had ...
Sabareesh's user avatar
  • 358
0 votes
1 answer
531 views

How to access custom attributes from the current product in JavaScript?

I added the following in view/frontend/layout/catalog_product_view.xml: <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
bfontaine's user avatar
  • 167
6 votes
3 answers
5k views

Magento 2 - Override Mixin with another Mixin

The module Amasty_HidePrice overrides mage/validation by using a mixin. But this mixin has a bug and I need to fix it by overriding the mixin with my own mixin. This is the original mixin (shortened ...
Black's user avatar
  • 3,280
0 votes
1 answer
836 views

Magento 2: using knockout components within a component

I am trying to render a new KO component within a existing KO template. I have a PackagePopup component which in the template, renders a PackageFfilter component. I would like to seperate the logic ...
user2594875's user avatar
0 votes
1 answer
1k views

Add custom javascript after js components load

I'm still a novice when it comes to Magento 2 frontend with jsLayout, requireJS, etc. I have a custom module where, in javascript, I am trying to attach an onchange listener to the email textbox. I ...
Nick Rolando's user avatar
  • 1,212
2 votes
1 answer
716 views

inheritance in knockoutJS components within magento 2's knockout framework

I have been experimenting with a custom module with KnockoutJs on the frontend in M2. I've created two components: a ProductPackage and a ProductPackagePopop. Functionally, the ProductPackage triggers ...
user2594875's user avatar
0 votes
1 answer
1k views

How to pass current value of Ui form field in js file

I want to pass the value of checkbox in custom js file, I am using UI component to create a chechbox. So I have to pass this value to js file and then use that value in Model. I am not able to pass ...
Arun Sharma's user avatar
  • 1,305
0 votes
0 answers
138 views

Magento 2: Adding a Javascript library

I am trying to add an animation library called Sal, built on pure Javascript (Does not rely on jQuery). Maybe I am missing something, but I followed the instructions on adding via require-config, and ...
dimanotdemo's user avatar
0 votes
2 answers
314 views

Magento 2 - Create simple hello world script with uiComponent

I try to create my own Component and reuse it. So I created these files: THEME = app\design\frontend\company\fresh Component File: THEME\web\js\elements\custom\input_number.js define([ "...
Black's user avatar
  • 3,280
0 votes
1 answer
275 views

Magento 2 Uncaught TypeError: Constr is not a constructor when returning functions on Knockout Js

i'm trying to get functions from a JS file in a Knockou file, like this: quote.js define(['jquery', 'uiComponent', 'ko','Vendor_GetQuote/js/ajax-request'], function ($, Component, ko, ajaxrequest) { ...
Oscar Vazquez's user avatar
0 votes
4 answers
524 views

Magento 2 - How does require know where jquery is defined?

You can use jquery in phtml like this: require([ 'jquery' ],function($) { $(document).ready(function() { /* Your logic */ }); }); But how does the require know where to find ...
Black's user avatar
  • 3,280
0 votes
4 answers
649 views

Magento 2 - How to use jQuery3?

I try to include jQuery 3 to my project so I can use it on some CMS sites. Attempt: THEME = app\design\frontend\company\fresh\ THEME\web\js\jQuery\jquery-3.6.0.js Copy pasted the code from here to ...
Black's user avatar
  • 3,280
0 votes
2 answers
842 views

How to add color picker in widgets in magento 2.3

i want to add color picker in widget https://magento.stackexchange.com/a/190260/73525 This above link is working for system config same thing i want in widget as field Any one have idea about this
prabhakaran7's user avatar
  • 1,077
0 votes
0 answers
1k views

Javascript mixin issues - base is not a constructor

I ran into an interesting issue while trying to create a mixin for a 3rd party JS script. I created the mixin in the normal way with my requirejs-config.js like this: let config = { config: { ...
circlesix's user avatar
  • 4,273
2 votes
1 answer
819 views

Getting the dreaded inconsistent $fotoramaElement.fotorama is not a function

I see quite a few people have this issue, but I can't find a solution that works. I have app/design/frontend/Smartwave/porto_child/requirejs-config.js and I have it shimed, but I'm getting the same ...
web master's user avatar

1
2 3 4 5
11