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
1
vote
0answers
12 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 ...
0
votes
0answers
11 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 ...
1
vote
1answer
30 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 /** * ...
0
votes
0answers
18 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 ...
0
votes
2answers
32 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 ...
0
votes
0answers
11 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?
0
votes
2answers
33 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, ...
1
vote
1answer
27 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/...
2
votes
0answers
20 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....
0
votes
1answer
80 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 ...
0
votes
1answer
29 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:...
0
votes
0answers
11 views

Require js advance bundling adding .js after html templates

We are using Magneto 2.4.1 EE AND trying to implement advance bundling but some how its also including .html templates(checkout / registration etc ..) Please see the attached screenshot This is ...
0
votes
0answers
16 views

Format Number in Store Currency in Product Page by javascript

I need to show a number with the store price format in the product page. Most of the occasions it is proposed to use 'quote' library, but it doesn't work when the cart is empty. When I try to use this ...
3
votes
3answers
402 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 ...
0
votes
1answer
30 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 ...
0
votes
1answer
40 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 ...
2
votes
1answer
50 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 ...
0
votes
1answer
38 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 ...
0
votes
0answers
26 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 ...
0
votes
0answers
19 views

magento 2 baler build stuck

I integrated baler in Magento 2 EE. I followed below steps. - $ git clone https://github.com/magento/baler.git - $ npm install - $ npm audit fix - $ npm run build But when I run this command it is ...
0
votes
0answers
12 views

Require Js query

I found a line like below in require-config.js of a module shim: { 'MagePal_GoogleTagManager/js/datalayer': ['Magento_Customer/js/customer-data'] } What it means please explain.
0
votes
0answers
9 views

Magento2.3.3 Custom js widget gets loaded but then stops working

Hello i know this ma be hard to anwser but it tought i can all way's try. I have a custom js widget that gets loaded on the frontend, This Javascript starts running but and i does what it needs to do ...
0
votes
0answers
15 views

Blank-Theme Customize: How duplicate and customize Toggle-nav action

I just create a new theme based on theme_frontend_blank and i now would customize navigation menu on mobile device. I would create this kind of scenario: I had create Account right icon modifing ./...
0
votes
2answers
89 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([ "...
0
votes
1answer
33 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) { ...
0
votes
0answers
25 views

Generating bundling js in wrong directory, without vendor_module

I have a custom bundlingjs file for a specific page on magento 2, and I'm trying to run this command: r.js -o pub/static/my_bundling_file.js baseUrl=pub/static/frontend/vendor/theme/locale_tmp dir=pub/...
0
votes
4answers
44 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 ...
0
votes
4answers
167 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 ...
0
votes
1answer
73 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
0
votes
0answers
142 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: { ...
1
vote
1answer
34 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 ...
0
votes
1answer
42 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 ...
0
votes
2answers
80 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 ...
0
votes
0answers
74 views

Uncaught TypeError: Cannot set property 'swipe' of undefined while loading PDP and keep on loading

I have used a custom theme in Magento 2.4.1 I am facing a console error while loading PDP & Page kept loading as well. gallery.js:189 Uncaught TypeError: Cannot set property 'swipe' of undefined ...
1
vote
1answer
93 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 ...
1
vote
1answer
112 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/...
0
votes
1answer
87 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 ...
0
votes
0answers
24 views

Random JS errors on Magento 2.4.1

I am getting Random JS errors on a website built with Magento 2.4.1 and Apache2. Tried many solutions but no luck. Here are the some screenshot attached. I am using Magebig Martfury theme. Did ...
0
votes
0answers
6 views

require.js error on magento fresh installation

I am deploying Magento for first time locally, XAMPP on windows, with PHP 7.4.8 I have run php bin/magento setup:install and all seems to go smooth but now I am trying to access the admin and I have a ...
0
votes
0answers
23 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:...
0
votes
0answers
64 views

Magento 2 product page , Safari mobile view only JS Issue

I'm having a weird issue on my magento 2 website on product page only on safari mobile view! when I add any js file as follows in global-footer-js.phtml (this phtml I call in default.xml as it should ...
0
votes
2answers
66 views

Require JS script implementation issue

I am trying to implement the SurveyJS library into my page but it doesn't seem to work at all and I keep getting "Survey is undefined" whenever I call the Survey object methods, as detailed ...
0
votes
0answers
14 views

Magento 2 developer mode only half loads required js

I have a weird problem whereby when I'm in Developer mode, none of my JS files are loading properly. They are almost always cut a few bytes short of the EOF. For example: Now when I manually go to ...
0
votes
1answer
241 views

How can I integrate jquery-ui-touch-punch into my module (mobile friendly slider)

So, I created a slider with jquery/ui and it is working so far. But as jquery/ui doesnt support touch events, I am trying to integrate jquery-ui-touch-punch. I tried to declare it in my requirejs-...
0
votes
1answer
275 views

Calling a JS function from a widget from a different widget?

How can I call giveAlert() function that's in newsletter.js from within landingpage.js? landingpage.js define([ "jquery", "Ignite_Orgbf/js/js.cookie", "...
0
votes
0answers
30 views

Three is not defined in Magento 2

new THREE.WEBGLRENDER Three is not defined when i'm using it in Magento 2 with requirejs . THREERENDERER = new THREE.WebGLRenderer({ context: spec.GL, canvas: spec.canvasElement });</quo you can ...
0
votes
0answers
32 views

QuickView button misplaced after products loaded Using infinite scroll Magento 2

I am using Weltpixel Quick View extension and it is working fine. But there is an issue when products loads using infinite scroll. After loads, the Quickview button is appended at the end of div with ...
1
vote
1answer
116 views

<referenceBlock name="header.container" remove="true" /> removes minicart functionality

I've added <referenceBlock name="header.container" remove="true" /> to my themes default.xml and instead has been replaced with: <referenceContainer name="page....
1
vote
0answers
37 views

RequireJS module - abstract dependency injection in Magento 2

I am searching for a way to extend a JS file which is used as dependency in other JS files for the whole project. The file in use is Magento_Ui/js/form/element/abstract and I need to replace it with ...
0
votes
2answers
76 views

Cannot load external module through require js

I'm trying to load highcharts in a custom admin form, but it comes out as undefined in my module. My requirejs-config.js var config = { paths: { 'highcharts': 'http://code.highcharts.com/...

1
2 3 4 5
11