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
0answers
12 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 ...
0
votes
1answer
19 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 ...
0
votes
0answers
31 views
+50

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
22 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
16 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
16 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
7 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
35 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
13 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
74 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
35 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
27 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
16 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
102 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
35 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
46 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/...
0
votes
1answer
23 views

RequireJS and ES6 Style Javascript Module Plugin (Specifically moment-range for moment js) How To Setup Require Config?

I want to load this plugin "moment-range" for Moment which is in ES6 Format here: https://github.com/rotaready/moment-range/blob/master/lib/moment-range.js They do also have it in this ...
1
vote
2answers
86 views

Magento 2 - How to override Method getShippingMethodTitle in Magento_Checkout/view/frontend/web/js/view/summary/shipping.js

I need to override the method getShippingMethodTitle which is defined in vendor/magento/module-checkout/view/frontend/web/js/view/summary/shipping.js. The Method gets the shipping method title in the ...
3
votes
2answers
96 views

Magento 2 - How does getShippingMethodTitle know the method title in module-tax/view/frontend/web/js/view/checkout/cart/totals/shipping.js

I try to understand knockoutjs and requirejs more but I fail to understand the following case. In checkout the shipping method title is showing in the summary This is the template: vendor/magento/...
1
vote
1answer
31 views

How to add configurable external JS with data- attributes in Magento 2?

I want to add external JavaScript library in my module. It looks something like below script code <script src="<?php echo $block->escapeUrl($block->getJsLibUrl());?>" data-...
0
votes
1answer
158 views

Magento 2 - how to add methods to a javascript file by using mixins?

I am using the extension amasty/single-step-checkout. They are using this mixin... vendor\amasty\module-single-step-checkout\view\frontend\web\js\view\shipping-mixin.js (A) ...to extend this magento ...
1
vote
1answer
41 views

Magento 2 - How to override frontend javascript file

I need to overwrite a javascript file from a custom module at: vendor\amasty\module-single-step-checkout\view\frontend\web\js\model\one-step-layout.js because I need to replace a code line in it to ...
0
votes
0answers
43 views

Magento2 Uncaught ReferenceError: requirejs is not defined and require.js net::ERR_ABORTED 404 (Not Found)

when the mode is production then it is generating require.min.js when the mode is development it is generating require.js The website is now production mode but it is fetching require.js(but file is ...
0
votes
0answers
10 views

Magento2 requirejs-config recursive class map

Here is a piece of code-sample of a requirejs-config.js file which helps understanding my question: var config = { map: { 'Magento_Module/js/class1': { 'Magento_Module/js/...
0
votes
1answer
174 views

Magento 2 - How to add custom JS file path into CMS Block

How to get JS file in the blocks, How to declare like: <script type="text/javascript"> src="{{skin url=''}}js/my_custom.js"> </script> My JS path: app/design/...
0
votes
0answers
43 views

Uncaught SyntaxError: Unexpected token < in JSON at position 1 - Magento 2.3.5

I upgrade from magento 2.2 to 2.3.5 today, and is encounter the following error, also the checkout page shows nothing but the store header/logo area. ( the shopping cart page is ok), i think the ...
0
votes
1answer
95 views

How to use Lottie animation library in Magento 2?

we are using Magento V 2.3.5-p1. According to the client's requirements, they want to display animation in some of the pages. for that, they gave us .json file for animation. we have used Lottie js to ...
1
vote
0answers
30 views

Is it possible to use npm packages in Magento 2?

I see a post here from 2017 that gives an idea of how it's done, but I would want to use something like this that would allow people to sign their names on forms. I know how to create html/js ...
1
vote
0answers
8 views

Best Practice: When should I put requireJs into a separate file?

This is somewhat silly but I keep encountering extensions who vary on putting requireJS into a separate file vs inlining it. I usually decouple things where possible. Is it fair to say the JS should ...
1
vote
0answers
21 views

Get cart id using javascript

This question is in relationship with only the frontend. I want to get using javascript Visitor Id : If the customer is not logged in on any page. Customer Details: If the customer is logged in. Cart ...
1
vote
0answers
23 views

text/x-magento-init not getting triggered at all

Can't get text/x-magento-init to get triggered, I'm simply trying to inject trivial custom JavaScript. In my phtml template <script type="text/x-magento-init"> { "*": { ...
1
vote
0answers
31 views

How to create a mixin for js/modal/confirm.js

I want to create a mixin for js/modal/confirm.js but that widget returns some javascript to make it possible to create an instance of the widget instead of the widget itself. So it returns this // ...
2
votes
1answer
224 views

css and js not found in magento 2.3.5

Refused to apply style from http://localhost/magento2-2.3.5-p1/pub/static/version1593595791/adminhtml/Magento/backend/en_US/extjs/resources/css/ext-all.css because its MIME type ('text/html') is not ...
1
vote
0answers
32 views

Magento2 JS override

How to override Plumrocket_CartReservation/js/prcr file in the local module not in theme var config = { map: { '*': { 'prcr': 'Plumrocket_CartReservation/js/prcr', '...
1
vote
1answer
44 views

How to find Which Module Giving this error : Uncaught TypeError: Constr is not a constructor

Every UI Grid generating this Error. This Error Only giving in Live Not in local instance, as well as Other Server. All the Instance same Code Same DB. How to find Which Module Giving this error?
1
vote
0answers
55 views

Is there a way to remove deps config in requirejs-config.js in the other module?

I'm following the steps in this article on a default Magento sample data version and I want to remove 'mage/translate-inline' ADM from injected into the page. See here - https://prnt.sc/t7ao6j Is ...
1
vote
0answers
28 views

Is it possible to generate a dependency graph of files included via RequireJS?

In Magento 2 lots of JavaScript files are loaded via RequireJS. Those files, themselves, can also require more JavaScript files, and so on. This can make it difficult to determine where a specific .js ...
3
votes
5answers
475 views

Cookiebot throwing console errors in Magento 2.3.4

I have added cookiebot script into head tag, here is the script <script id="Cookiebot" src="https://consent.cookiebot.com/uc.js" data-cbid="0000-0000-0000-0000" data-blockingmode="auto" type="...
1
vote
0answers
12 views

Magento 2 config CDN for specific file type only

Magento 2 allow to add another url for static views file, but all static file types will be requested to this url. I want to some only file types be served using that url. Example *.js and *.css ...
0
votes
1answer
155 views

Uncaught Error: Mismatched anonymous define() module: function(t,g,u)

I have a fresh installation of Magento but this error is showing on all of the pages.This may be duplicate of some other but I cannot find solution for my problem so asking here. When I trace back it ...
0
votes
2answers
37 views

Requirejs not finding third party file

I'm trying to include Firebase in my website, so I decided to include the dependencies through requirejs. Thing is requirejs can't find my files for some reason. What I first tried was to load the ...
0
votes
0answers
29 views

Uncaught SyntaxError: missing ) after argument list for all js files magento2

I have a fresh installation of magento 2.3.3. I want to move m2.2.7 database from to this installation instead of upgrade because there are many other issues in 2.2.7. I moved the db and extensions ...
0
votes
1answer
56 views

Magento 2: Location of uiRegistry.js file

I am mapping some files for advanced javascript bundling in Magento 2 and I am trying to find the file uiRegistry.js. Does anybody know where to find it? Thanks.
0
votes
2answers
263 views

data-mage-init breaks in cms static blocks or pages - how do i get an accordion?

I have been trying to have some blocks with collapsible content, but to put them in cms blocks so the text can be maintained by a normal human I have found, thanks to previous stack discussions, that ...
0
votes
0answers
10 views

Email template preview show balck page and error of http://requirejs.org/docs/errors.html#scripterror on console

When i try to review email template in m2 it show requiresJS error on console. i am attaching a screenshot of that error .Please find the attachement
0
votes
1answer
68 views

Custom Module load JS when all content is loaded in Checkout

I created a custom module to show suggested addresses when customer type in the address fill. However, the requirejs load before the content of checkout page load, even though I have put "domReady!". ...
0
votes
1answer
96 views

How to add external js script in block via requireJs?

What is the simplest way to add external js script like: https://sandbox-geowidget.easypack24.net/js/sdk-for-javascript.js on my page? I've created block which i render on my product page. But i get ...
0
votes
1answer
31 views

Magento 2: remove all default JS for custom theme

We are creating multiple websites in one magento 2 instance with a custom theme. Those websites are not supposed to be shops. They all are serving one simple page without any of magento's ...
1
vote
0answers
115 views

How to use if condition(knockout) in html template ? magento 2

How to use if / else condition in html template file ?

1
2 3 4 5
10