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
1answer
6 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 ...
0
votes
0answers
31 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) @ ...
0
votes
3answers
45 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 ...
0
votes
1answer
17 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/...
0
votes
2answers
23 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/...
0
votes
0answers
18 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 ...
0
votes
1answer
41 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 ...
0
votes
1answer
45 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 ...
1
vote
0answers
29 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
13 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
51 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
34 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
37 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
12 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
83 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
30 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
48 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
2answers
162 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
62 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
12 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
23 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 ...
4
votes
3answers
1k 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
76 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
205 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
67 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
125 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
32 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
27 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
16 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
131 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
64 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
30 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
54 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
296 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
2answers
162 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
280 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
58 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
68 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
145 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
111 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
124 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
189 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
123 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
27 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
8 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
50 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
119 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
83 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 ...

1
2 3 4 5
11