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
16 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
4 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 ...
1
vote
1answer
23 views

RequireJs on uncheck checkbox value is not unset

Using requireJs when Checkbox get unchecked, it is not deleting that value from element.value function registerCategoryNews(grid, element, checked) { if (checked) { if (...
0
votes
0answers
10 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
6 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
72 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
20 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
20 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
40 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
53 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
44 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
36 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: { ...
0
votes
1answer
16 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 ...
1
vote
1answer
35 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
32 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
32 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
44 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
1answer
67 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
67 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
19 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
18 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
15 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
49 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
143 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
89 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
24 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
109 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
58 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
33 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
129 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
137 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/...
2
votes
1answer
45 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
371 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
48 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
76 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
11 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
283 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
49 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
124 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
42 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
29 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
43 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
305 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
2 3 4 5
11