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
9 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 ...
user avatar
0 votes
1 answer
16 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: ...
user avatar
0 votes
1 answer
17 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": { "*": { ...
user avatar
0 votes
0 answers
16 views

How to condition check a product attribute in a JS Mixin?

Using Magento 2 I am trying to do a condition check on a mixin I created for the update function on the mini-cart. The code looks like this: define(function (customerData) { 'use strict'; ...
user avatar
0 votes
0 answers
24 views

Requirejs mapping not working

There seems to be an issue with a module I have called Aheadworks AutoRelatedProducts. Basically, the requirejs section looks like this: map: { '*': { 'awArpGrid': '...
user avatar
  • 136
0 votes
1 answer
69 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 ...
user avatar
  • 26
2 votes
2 answers
198 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 ?
user avatar
  • 68
0 votes
0 answers
15 views

Developing vendor module could not pull js on adminthml

I am preparing new module in vendor folder directly. I have created requirejs-config.js in view/adminhtml and js path is at view/adminhtml/web/js but it is not working in admin area. here is the ...
user avatar
  • 2,038
0 votes
0 answers
37 views

How to remove JS if it's defined in requirejs-config.js section "deps" of the parent theme

Have an interesting question. How can I get rid of js module changing files only in my current theme if js was required in the parent theme (this theme is used by other themes as a parent) In ...
user avatar
0 votes
2 answers
37 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 ...
user avatar
0 votes
0 answers
29 views

Magento 2 - How to implement Bento Survey Script?

How to setup bento survey in Magento 2 ? Need to add below in head tag. <bento-survey-form id="old-glade-12345" type="popup" delay="5"></bento-survey-form> I ...
user avatar
0 votes
0 answers
20 views

Override js method outside of returned object

I'm trying to override a js function initSidebar() in vendor/magento/module-checkout/view/frontend/web/js/view/minicart.js I've been trying to use a mixin to do this but because this function is ...
user avatar
  • 1,180
0 votes
1 answer
41 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 ...
user avatar
0 votes
0 answers
99 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) @ ...
user avatar
0 votes
3 answers
83 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 ...
user avatar
  • 1,083
0 votes
1 answer
50 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/...
user avatar
  • 581
0 votes
2 answers
61 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/...
user avatar
  • 120
0 votes
0 answers
25 views

javascript to external js in magento2

I am having javascript code in my phtml file, but I want to do it from layout and create separate phtml file pass variable from require js. Can anyone tell me how to do this? My phtml file code is ...
user avatar
  • 1,083
0 votes
1 answer
61 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 ...
user avatar
0 votes
1 answer
71 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 ...
user avatar
  • 23
1 vote
0 answers
62 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 ...
user avatar
  • 704
1 vote
0 answers
19 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 ...
user avatar
  • 2,413
1 vote
1 answer
412 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 /** * ...
user avatar
  • 13
0 votes
0 answers
57 views

Uncaught RangeError: Maximum call stack size exceeded at Object.ctx.nameToUrl in requirejs-min-resolver.min.js in Magento 2 error in console

I am facing this issue after minifying of Js in my magento 2.3.7 at only on category catalog page. 33 VM818 requirejs-min-resolver.min.js:1 Uncaught RangeError: Maximum call stack size exceeded at ...
user avatar
0 votes
2 answers
78 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 ...
user avatar
0 votes
0 answers
14 views

Javascript modules are loading before requirejs

I've some extensions installed. It uses requirejs to load its javascript files, however, on some pages, these modules are requested before requirejs itself. Has anyone experienced something like this?
user avatar
  • 11
0 votes
2 answers
223 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, ...
user avatar
  • 197
1 vote
1 answer
38 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/...
user avatar
  • 609
3 votes
0 answers
95 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....
user avatar
  • 125
0 votes
2 answers
375 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 ...
user avatar
  • 298
0 votes
1 answer
121 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:...
user avatar
  • 121
4 votes
3 answers
2k 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 ...
user avatar
  • 2,413
0 votes
1 answer
221 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 ...
user avatar
0 votes
1 answer
377 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 ...
user avatar
  • 1,180
2 votes
1 answer
126 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 ...
user avatar
0 votes
1 answer
295 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 ...
user avatar
0 votes
0 answers
61 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 ...
user avatar
0 votes
2 answers
150 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([ "...
user avatar
  • 2,413
0 votes
1 answer
111 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) { ...
user avatar
0 votes
4 answers
108 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 ...
user avatar
  • 2,413
0 votes
4 answers
428 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 ...
user avatar
  • 2,413
0 votes
2 answers
331 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
user avatar
  • 1,047
0 votes
0 answers
535 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: { ...
user avatar
  • 4,153
1 vote
1 answer
161 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 ...
user avatar
0 votes
1 answer
116 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 ...
user avatar
0 votes
2 answers
231 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 ...
user avatar
1 vote
1 answer
177 views

Execute mixin only when my custom module is enabled from configuration

I've implemented swatch-renderer-mixin through require-js. It's working fine but I need to only run it when my module is enabled. What's the best way to check it in my mixin.js file? This is my ...
user avatar
1 vote
1 answer
252 views

Stellar and Owl Carousel randomly show up as not a function

I'm using the Porto Theme (of course - Porto is making trouble), and I randomly get console errors for both $(...).owlCarousel is not a function and $(...).stellar is not a function. under design/...
user avatar
0 votes
1 answer
168 views

mage/util/wrapper returning undefined and breaking field after 2.4.2 (works on 2.4.1)

I have a module that contains a requirejs that uses and extend 'Magento_Ui/js/form/element/abstract'. When calling var validate = this.validate(); on Magento 2.4.1, the validate method is triggered on ...
user avatar
0 votes
0 answers
118 views

Require.js loads the function (it exists in bundle.js), but console throws "not defined"

Having an issue with one of the plugins recently installed. My DEV server and local DEV servers both are working normal, not throwing errors, but PRODUCTION server throws "Uncaught ReferenceError:...
user avatar

1
2 3 4 5
11