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
2answers
26 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
0answers
6 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
44 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
47 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
18 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
37 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
36 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
22 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
85 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
34 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
50 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 ...
0
votes
0answers
14 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
7 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
13 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
18 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
20 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 // ...
1
vote
0answers
12 views

jQuery widget: adding ReuireJS dependency and calling public method

I have a custom widget defined like this define([ 'jquery', 'jquery/ui'
], function($){ $.widget('myNameSpace.myWidget', { somePublicMethod: function () { ...
2
votes
1answer
138 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
37 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
23 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
20 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
346 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
87 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
34 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
25 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
31 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
146 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
37 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
55 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
29 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
64 views

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

How to use if / else condition in html template file ?
0
votes
1answer
28 views

Magento store optimization?

I am facing problem the total number of request send to server is 223 which is huge and due to which loading time is 13 seconds How can I reduce number of elements I have merged and minify JS and css
0
votes
0answers
44 views

How to take Product attribute value and pass in JS?

I want to get attribute value which is date and wants to pass it into JS file, I have my JS files linked up properly, basically I am displaying timer in product detail page and I want to display timer ...
-1
votes
1answer
31 views

Magento 2 - How to use jQuery $ in script injected with requireJs?

I try to include a script and use jQuery in it by using $ instead of jQuery THEME\Magento_Catalog\templates\product\view\gallery.phtml <script> require([ 'jquery', '...
0
votes
0answers
12 views

Issue : When my widget load , my Jquerry no more avaible

I try to add Widget on product page that is a calendar which use jquery in an another webservice . In my phtml i use file_get_content But when i do this my widget does load corectly but all my other ...
0
votes
1answer
22 views

Adding custom JS (Slick Slider) to Magento Custom Theme without overriding parent

I created a custom theme which is inheriting from the blank theme. Now I wanted to integrate Slick and found this article which I followed https://inchoo.net/magento-2/magento-2-slick-carousel/ My ...
0
votes
0answers
23 views

Include prompt widget in the mass action from Magento 2

My goal is to include a promp widget before choosing an option value from the mass action from the product grid. Here is my code so far: Vendor/ProductBarcode/view/base/web/requirejs-config.js : var ...
0
votes
0answers
30 views

Magento 2.3.4 admin not saving

Good day, From magento ce 2.3.4 admin just in configuration module I can not save or saving button is not working: a) Firefox most of the time not working B) google chrome sometimes not working c) ...
2
votes
2answers
222 views

Why is the loading of scripts via RequireJS incredibly slow when they are not cached?

First of all, this is not a question about general Magento 2 performance. I'm already aware of how to speed up Magento 2, in general. My question is specifically about RequireJS and the assets served ...
0
votes
2answers
41 views

cannot find my custom js file

I have created under app/code/vendor/theme/view/frontend/layout/defaul.xml an file called default.xml and i have following content in it: <?xml version="1.0"?> <page xsi:...
0
votes
3answers
105 views

Magento 2.3 How to check that customer is logged in using Js

I want find the whether the customer is logged in or not using Js. I got some links but it dosen't works and i not good at knockout js. Please give solution with brief explanation Referred Link : ...
0
votes
1answer
92 views

Map multiple js files in requirejs

I want to include yahoo.js and yahoo-calendar.min.js from my custom module yahoo.js yahoo-calendar.min.js basically i need to call the function from yahoo-calendar.min.js which require yahoo.js ...
2
votes
1answer
223 views

How to Override 3rd party module requirejs-config.js film in my custom module?

The above one is the 3rd party module's require-config.js. It contains the js file inside the adminhtml/web/js. I want to override that. So I created a custom module and made changes in the require-...
1
vote
0answers
73 views

Firebase undefined

I'm trying to build a cloud messaging module working with firebase. I have followed the magento dev docs tutorial on how to implement 3rd party javascript resources, I used requirejs. And yet, ...
1
vote
1answer
205 views

Magento2.3: The attribute 'data-requiremodule' is not allowed

I upgraded the Magento version 2.1 to 2.3, the following error has occurred in the backend. 1 exception(s): Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'script', ...
0
votes
0answers
47 views

Update Magento 2 jquery-ui.js version in Custom Theme

Is there a way to override Magento 2 lib\web\jquery\jquery-ui.js version in my Custom Theme? I want to upgrade it to version 1.12.1.

1
2 3 4 5
10