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
27 views

Advanced JS Bundling - What to include/exclude

So, I've been doing an advanced js bundling for my website and I've read a lot of information about it. I've decided to use m2 dev tools to help me do it, however, I've some doubts with the result I ...
1
vote
1answer
30 views

js files are automatically deleted - adminhtml/web/js/components/use-parent-settings

In my M 2.2.6 I can not enter the Category section of dashboard, the spining is turn around. When I check the console, some of JS has 404 error In - adminhtml/web/js/components/use-parent-...
0
votes
0answers
7 views

How to create a local callback to a JS via CDN using RequiredJS?

I've some JS files included in my themes and modules, but sometimes these files are not loaded, becaused of adblock or CDN server down. I checked the RequireJS documentation and I saw that it's ...
3
votes
2answers
45 views

What is the difference of map vs path?

What is the difference between map vs path when building a theme / module? Which are the restrictions? var config = { map: { '*': { 'jqueryjs': 'India_Newtheme/js/jquery', '...
0
votes
0answers
20 views

Why is it adding a min extension to the JS path getting a 404?

I'm requiring an external JS file via requirejs-config.js but my Magento 2.3.2 is getting with .min included, but there is no this .min, so I'm receiving an error 404, I don't want to move it to my ...
0
votes
0answers
12 views

Magento 2 mixin error

I didn't use mixin in my custom theme or anything. But I get the below error. TypeError: mixin is not a function My require-config.js is below. var config = { paths: { 'owl.carousel': '...
0
votes
0answers
35 views

Magento 2 rewrite widget function with mixin return an error

I have to add few lines on js functions but mixin not working. app/design/frontend/Konect/base/Magento_ProductVideo/requirejs-config.js var config = { config: { mixins: { '...
0
votes
0answers
21 views

Magento 2 Remove Javascript from requirejs in child theme

We're extending the Magento_Blank theme to create our own child theme. Magento_Blank includes some js via require_js theme.js and responsive.js` which are not required. I cannot figure out how to ...
0
votes
1answer
49 views

How to properly create mixins in Magento 2 JS?

Hi I'd like to know what is the best way to create mixins in core required-js. Instead of copying this files to working theme and make changes: vendor/magento/module-product-video/view/frontend/web/...
1
vote
1answer
24 views

How to add a JS Component via XML?

How could I add a new JS Component, using required and following the Magento's pattern via an XML which I can determine a unique page (e.g. using a checkout_index_index.xml) I don't want to create a ...
0
votes
1answer
34 views

how come this override doesnt work magento 2

var config = { "map": { "*": { "Magento_Checkout/js/model/shipping-save-processor/default": "module_name/js/shipping-save-processor/default-override" } } }; var ...
4
votes
0answers
63 views

How to add custom validation for Street 1 in Checkout page > Add shipping address in Magento 2.2.8?

How to add custom validation for Street 1 in Checkout page > Add shipping address in Magento 2.2.8 ? I want to apply custom validation on Street 1 field and I have tried below things. Method 1 I ...
0
votes
0answers
35 views

Magento 2 Admin Broken

I've got a Magento 2 dev installation all setup, I've pulled from my repo and setup the site. The frontend seems to be working OK, I can see information being pulled from the database. The issue is ...
0
votes
2answers
72 views

How to load JavaScript after Ajax has loaded?

I have a custom payment module and I am trying to show a message on the payment page using jQuery. My JS file is being called on the shipping page but not when the user clicks on the next step and ...
0
votes
0answers
76 views

Error while using croppie.js library in magento 2

Trying to use the croppie library on product detail page and sometime it works perfectly but most of the time it throws one of these errors. TypeError: priceBoxes.priceBox is not a function ...
1
vote
1answer
45 views

Magento 2 pass data from template phtml to js file

I want to call an ajax function on a button click. All other things are working fine. But I can't read the parameter which is passed to the js. How can I do it? Here is my code. Phtml file <...
0
votes
0answers
9 views

JS component returning object does not run object's function where key matches component name

According to Magento 2 documentation, when building a JavaScript component: If an object is returned, the initializer tries to find the key. If the corresponding value is a function, the ...
0
votes
0answers
30 views

Magento 2: Advanced JS Bundling Automate

I am implementing Advanced JS Bundling in my Magento 2.3.2 EE store. The part in which we create build.js on root by combining nodes of deps, shim, paths, and map from requirejs-config.js . I want to ...
0
votes
0answers
29 views

Magento 2: Simple case scenario, what to use? RequireJs , UI, JavaScript ? help from a backend developer

I have been doing a magento 2 course and it's more centered around backend development, but I would like to know what to apply for a simple case scenario. Case scenario : When I visit a specific url, ...
1
vote
0answers
27 views

Magento2: Getting Random Javascript errors in console

I am getting error on live website. Everytime i encounter with new error in console.Few of them shown below: Let me know how to solve it.
0
votes
0answers
18 views

keep extend Magento_Ui/js/form/element/wysiwyg but remove component dependency

I just want to extend almost content (not duplicate content to second file). And only remove component 'Magento_Variable/variables'. For reason i don't want to use variables in wysiwyg Is there a way ...
0
votes
1answer
36 views

Magento2: How to call js function in custom file

I want to call a particular third party js function in my custom js file. XXX/YYY/view/frontend/web/js/view/payment/method-renderer/cashondelivery-method.js. define([ 'Magento_Checkout/js/...
1
vote
2answers
45 views

Magento 2.3.X Custom Module JavaScript won't load with require.js

I am building a module, and the HTML loads fine, but the JS isn't. Here is what I have: Vendor Name: NewShop Module Name: HelloWorld File: app/code/NewShop/HelloWorld/view/frontend/requirejs-config....
0
votes
0answers
38 views

How we can use Js Mixins for order scripts.js

I want to override switchPaymentMethod from module-sales/view/adminhtml/web/order/create/scripts.js for that I use mixins: app/code/Vendor/Module/view/adminhtml/requirejs-config.js var config = { ...
0
votes
4answers
204 views

TypeError: require.config is not a function in Magento 2

Js, CSS is not loading properly.
0
votes
0answers
51 views

Magento2 slick slider issue on page load

I am applying slick slider on the home page at widget but on page load, it is not loading properly but after page load, ends it works fine and when the page loads completely it looks like this ...
1
vote
2answers
34 views

How to add custom JS in admin Magento 2

I'm trying to add a custom js file in magento 2 in the admin but all I can see are sample on how to add in the frontend. I found some that shows how to add in admin but none works. Below are my code ...
0
votes
1answer
46 views

Third Party JS not Working using require js Magento 2.3.2

We are trying to create new Theme in Magento2. We have a problem in executing third party js file. requirejs-config.js file configuration var config = { deps: [ "js/default" ], paths: { ...
0
votes
1answer
43 views

Add Js code for Google measuing checkout in checkout

I want to measure checkout page using tag manager Enhanced Ecommerce. I refered https://developers.google.com/tag-manager/enhanced-ecommerce#checkout. How to add this script. Thanks.
0
votes
3answers
188 views

Magento2.3: How to exclude 3rd party .js from minification

I have read this https://github.com/magento/magento2/issues/5835 and this Exclude custommodule Js from minification of Js in Magento2 and this https://github.com/magento/magento2/pull/13687 and I ...
0
votes
0answers
28 views

Error while extending jQuery widget

I'm trying to extend the widget in vendor/amasty/label/view/base/web/js/label.js and override a functionality in one of its methods. The error I get is: TypeError: base is not a constructor in ...
0
votes
1answer
23 views

On load of page click trigger only once

I have used the following script in a .phtml file require([ 'jquery' ], function ($) { $('#update-shipping-method-submit').trigger('click'); }); My issue is after loading of ...
0
votes
1answer
41 views

Surveyjs with magento2

I am integrating survey js with Magento 2. Referring the below link. https://surveyjs.io/Documentation/Library/?id=Add-Survey-into-your-Web-Page But facing an issue: Uncaught ReferenceError: ...
2
votes
1answer
60 views

If script is includeed from default_head_blocks.xml error is noticed

I am developing a site in magento 2.3 flurys.digifrizz.com If script is included through default_head_blocks.xml there are lots of require js error noticed <page xmlns:xsi="http://www.w3.org/2001/...
0
votes
0answers
24 views

How to solve Magento2.3.2 optionConfig[optionValue].prices undefined?

I have a custom module creating a custom option group for products. I managed to have the admin and frontend display working, I can see the custom options checkboxes and I can select them in the PDP ...
1
vote
2answers
38 views

How load only the required JS based on page?

I created a cms blank page and i found that it loads 179 js scripts, that slow down page loading. I assume that the problem is the theme i'm using. I want that pages loads only the stricly necessary ...
0
votes
1answer
46 views

sectionLoadUrl error while updating cart price total Magento 2

I am updating the cart total price dynamically without page reload. I wrote code in js file require( [ 'Magento_Checkout/js/model/cart/cache', 'Magento_Checkout/js/model/cart/totals-processor/...
0
votes
0answers
22 views

How can I add custom heading in tiny mce 4 editor in Magento2?

I want to add custom heading in tinymce 4 editor in magento2. Is anyone having knowledge? like below screen shot.
0
votes
1answer
27 views

theme magento 2 not working

I installed magento 2 on my computer and I copied the code of the theme in the app\design and pub\ that works on the server but it does not work properly on my computer. Help
0
votes
1answer
24 views

Why We Use RequireJS on Magento 2

Please tell me why we use requirejs and require-configjs files and purpose of these two files on magento 2.Complete Details if Possible.
1
vote
1answer
83 views

Knockout Js get value from Config

I want to see if my module is enabled in config are through html using Knockout JS. ko if: module_enabled ==1 show a button if not don't show a button But i get this following error Uncaught ...
0
votes
1answer
43 views

How to fix blank Minicart popup in custom navbar for Magento 2

I am creating a custom theme from the parent theme Luma. I've added this code to Magento_Theme/layout/default.xml to include the minicart. <block class="Magento\Checkout\Block\Cart\Sidebar" name="...
3
votes
0answers
43 views

magento 2 - ui componet grid (Backend)

Can this be achieved in magento 2 Ui Component.
0
votes
1answer
96 views

Add custom data-attribute inside script tag of custom JS

I would like to add a custom data-attribute to a javascript injected in the frontend area using a custom module. My custom javascript is inserted using var config = { map: { ...
1
vote
1answer
36 views

Page loads take around 10 minutes due to requirejs

I have a local site running Magento 2 Enterprise set up on a Hyper-V virtual machine running Ubuntu 18.04 and Nginx. I've got 4 CPUs and plenty of RAM assigned to the virtual machine. This same site ...
0
votes
0answers
82 views

Magento 2: jQuery update to 3.x causing issues with RequireJS

I've just updated my jQuery version in Magento to 3.1.4, now all of a sudden in my console it's showing this error. I know the mobile isn't compatible yet though the Require.js errors were never there,...
2
votes
1answer
148 views

Magento 2 extend $.mage.quickSearch Widget

I don't seem to be able to extend quick search module widget form-mini.js found in module/path: ../vendor/magento/module-search/view/frontend/web/form-mini.js How can I extend in my custom module $....
2
votes
4answers
231 views

How to override both shipping.html and shipping.js file in custom module magento 2

override both shipping.html and shipping.js I am trying to override shipping.js file in magento 2 but can not working. requirejs-config.js var config = { paths: { 'Magento_Checkout/template/...
0
votes
1answer
21 views

Magento 2 require Js Component Init: not working

I am having a problem, while initializing. If I define those in document.ready it works as expected,but of-course my functions couldn't be called from that scope. web/js/shadefinder.js define([ '...
1
vote
1answer
77 views

Porto - include Mageplaza LayeredNavigation in js file

I'm making a custom theme based on porto. I'd like to include the Mageplaza_LayeredNavigation/js/view/layer in the toolbar.js file of the the Magento_Catalog module, in my custom theme. I tried ...