Skip to main content

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
0 answers
17 views

Magento 2 : Use widget function from an other jquery widget

How can I use a custom widget function in a magento 2 jquery widget? requirejs-config.js var config = { "map": { "*": { "customwidget": "...
Waffeleater's user avatar
0 votes
1 answer
126 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
  • 493
2 votes
0 answers
41 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
61 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
2 votes
0 answers
430 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
314 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
1 answer
347 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
1k 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
53 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,390
5 votes
2 answers
8k 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,211
0 votes
1 answer
411 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
288 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
179 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
162 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
190 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
680 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
2k 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
3k 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
46 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
416 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
678 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
770 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
232 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
  • 660
0 votes
2 answers
671 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
81 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
123 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
183 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
  • 771
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,390
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
735 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
95 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
157 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
933 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
557 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
  • 122
6 votes
3 answers
6k 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,390
0 votes
1 answer
953 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
850 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,327
0 votes
0 answers
144 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
326 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,390
0 votes
1 answer
307 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
626 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,390
0 votes
4 answers
658 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,390
0 votes
4 answers
957 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,097
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,323
2 votes
1 answer
1k 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
0 votes
1 answer
321 views

Magento: addEventListener on change radio button not working using requirejs

Here everything works fine just one issue is there, it doesn't the value and id of input radio fields, So I think domReady addEventListener is not working here. Help is really appreciated TIA This is ...
Arun Sharma's user avatar
  • 1,327
0 votes
2 answers
473 views

Whats the best way to resolve requireJS conflicts in 3rd party modules

I have 2 modules, Cart2Quote and a Swissup Ajax module. Both have requireJs configs that override the catalogAddToCart mapping. Siwssup_Ajaxpro Cart2Quote So the Cart2Quote modules init function is ...
Luke Collymore's user avatar

1
2 3 4 5
11