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.

200 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
7
votes
1answer
2k views

how to load or add js before require js in magento 2

I am trying to override default_head_blocks.xml like below vendor\magento\module-theme\view\frontend\layout\default_head_blocks.xml <?xml version="1.0"?> <!-- /** * Copyright © 2016 Magento....
6
votes
0answers
495 views

How to apply custom validation in Magento 2 checkout Shipping Address form?

In Magento2 - I want to apply some custom validation on shipping address form of Magento 2 Checkout. Normally I do it with JQuery but don't know how to apply it in Magento 2. The validation I want to ...
4
votes
0answers
306 views

Google Chrome is failing in loading require.js files in time

On Magento 2 (ver 2.2.5), with Google Chrome (ver 72.0) I'm getting a wired error I wasn't getting withe previous Google Chrome version (ver 71). When I visit a product page, I get more then one ...
4
votes
0answers
1k views

Magento 2 : Disable RequireJS (and all JavaScript)

Is there a way to disable RequireJS completely in Magento 2? I want to build a theme from scratch and I do not want to include any of JavaScript that Magento automatically includes, Including ...
4
votes
1answer
2k views

how to extend default javascript

I try to extend standard magento javascript configuration but I just get nothing. I'm following this: http://devdocs.magento.com/guides/v2.1/javascript-dev-guide/javascript/custom_js.html and this: ...
3
votes
0answers
45 views

magento 2 - ui componet grid (Backend)

Can this be achieved in magento 2 Ui Component.
3
votes
3answers
354 views

Uncaught ReferenceError: $ is not defined at pricing.js:122 in magento 2.3.0

Hi am getting an uncought referecne error when adding a custom JS in my theme. On the console I am getting this error- pricing.js:122 Uncaught ReferenceError: $ is not defined at pricing.js:122 My ...
3
votes
0answers
30 views

js not loading properly in backend product edit while click on show/hide of description field magento 2.2.4 production mode

This issue specific to production mode of Magento 2.2.4. Js is appending in product edit url like : base_url/admin/catalog/product/edit/id/57473/set/12/key/...
3
votes
0answers
305 views

Magento 2.2 x or 2.3 - to bundle or not to bundle

I've read so many conflicting write up's and blogs about whether to "Enable Javascript Bundling" or not. Some say it's slow and some say it's faster when enabled. From what I understand it takes all ...
3
votes
0answers
603 views

Uncaught TypeError: $.initNamespaceStorage is not a function magento2

Some functionality is not working properly and it shows some errors in console Any help will be appreciated.
3
votes
0answers
164 views

use system config value to disable code from requirejs-config.js

I would like to create a configuration setting in my module's adminhtml/system.xml to disable it's features. I know how I can system config values to disable code in LayoutXML or PHP but is it ...
3
votes
0answers
703 views

How to call a js function explicitly from phtml file in magento 2

I have the following file Vendor/Catalog/view/templates/product/view/type/options/configurable.phtml Content of that file as follows <?php /** * Copyright © 2013-2017 Magento, Inc. All rights ...
3
votes
1answer
577 views

Datatables jquery plugin in Magento 2?

Datatable version 1.10.15 requirejs-config.js var config = { paths:{ 'dataTables': 'df_Comercial/js/datatables.min', }, map: { '*': { 'dataTables': '...
3
votes
0answers
1k views

magento 2 knockout js / require js subscribe to another files parameter

What I need to do is subscribe to another file / object via knockout js and require js. For example I have in File1.js: define( [ '/path/to/some/component', 'ko' ], function (Component, ko) ...
3
votes
1answer
737 views

RequireJS components sometimes not loading

We are launching a Magento 2.1.3 site, and finding that the site will sometimes load all of its Javascript components and dependencies properly, but sometimes fails to load, in which case a slider is ...
3
votes
0answers
183 views

What does the “initUnique” Method setup in uiElement Objects?

In Magento 2's uiElement objects, one of the initialization methods is named initUnique initialize: function () { this._super() .initObservable() .initModules() ....
3
votes
1answer
410 views

How to add a custom data-bind function to a minicart item in Magento 2

I'm trying to add some functionality to the minicart product items. On product list and view I was able to add this throught requirejs/knockout. Now, I can't find how to work with the minicart item. ...
3
votes
0answers
2k views

Require Js Error: Mismatched anonymous define() module: function Magento 2

I am facing Error: Mismatched anonymous define() module: function ($) { 'use strict'; require.js on line 166 error in my custom extension when i am trying to load external js. Below is my code. ...
2
votes
2answers
81 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 ...
2
votes
1answer
109 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/...
2
votes
1answer
42 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 ...
2
votes
1answer
26 views

Why isn't Magento 2 recognizing my library in requirejs-config.js?

This is Library location app\design\frontend\user\theme\web\js\owl.carousel.min.js this is my config js file app\design\frontend\user\theme\requirejs-config.js var config = { deps: [ "js/...
2
votes
0answers
44 views

I have added js using require js but it is not attached

I have added javascript files in require js but it is not showing in the inspect element that my javascript files are attached and it is not working. What should I do? I have cleared cache and folders ...
2
votes
1answer
329 views

Upgrade to 2.2.6 missing static JS files

When I upgraded my Magento 2.2.2 to 2.2.6. I got one critical error in pub/static missing one file named trim-input.js "pub/static/version1540806968/frontend/{...}/{...}/pl_PL/mage/trim-input.js" ...
2
votes
1answer
456 views

Magento 2 TypeError Undefined products images not displaying / js not loading

At home page, product category view and product detailed view page images are not loading / displaying at firefox and less frequently at chrome. I am using magento 2.2.6 upgraded from 2.2.2 and porto ...
2
votes
0answers
168 views

New Checkout Billing Address Form Field not saving value to the database

I have added a new checkout billing address form field for entry of an optional field for the customer. Have overridden the template checkout form and able to get the field onto the form, but cannot ...
2
votes
0answers
22 views

Trigger code on every popup

I wrote a specific code but it should run only when a popup is on. Not only a specific popup but all the popups on the site. How can I achieve it?
2
votes
0answers
45 views

Magento 2: Remove requirejs in checkout phase

I have a question over Magento 2 checkout phase. I don't want to talk about the decision of force developer to user requirejs knockoutjs and so on... Exist an extension which reproduce the checkout ...
2
votes
0answers
608 views

Issue with bootstrap 4 in magento 2

I am having issue while loading bootstrap 4 in magento 2 var config = { paths: { 'popper': 'https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.5/umd/popper.min', 'bootstrap': 'https://...
2
votes
0answers
250 views

Javascript file 404s when loaded via Require JS alias

I've ran into a strange problem where a custom javascript file 404s when loaded via a RequireJS alias but it works fine when loaded directly. This does not work Require JS var config = { map: { ...
2
votes
0answers
155 views

JS mixin on a js file with a single return in Magento 2

I'm having trouble with mixin in Magento 2. I would like to override the following file to edit a function. Magento_Checkout/web/js/model/new-customer-address.js: define([ 'underscore' ],...
2
votes
0answers
106 views

On Cart page, Estimate Shipping and Tax section not updating shipping rates on change of state and zipcode

My cart page only fetches shipping rates first time on the initial page load. After that changes in state and zip-code is not updating the shipping rates section. Can someone point out what can be ...
2
votes
0answers
755 views

Magento2: Lots of JS Errors on 2. -> Page Load

Hi Fellow Magento Users! I have a little problem with loading Javascripts.On first pageload after a cleanup of files and upgrade:setup i experience a page that loads javascripts really slow, and ...
2
votes
0answers
580 views

Add full version of jquery mobile to magento2

Magento2 loads by default a custom build of jquery mobile library: deps: [ "jquery/jquery.mobile.custom", If I try to add the full version of the mobile library (require it in my theme): var ...
2
votes
2answers
2k views

Magento 2 : How to Implement Swiper Plugin

I'm trying to convert html template to Magento 2.1.3. I started my conversion using blank-sass from Snowdog. Some CSS was sucessfully implemented but I can't figure out many points. One of them is how ...
1
vote
0answers
22 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
32 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
13 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
13 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 ...
1
vote
0answers
10 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 ...
1
vote
0answers
38 views

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

How to use if / else condition in html template file ?
1
vote
0answers
39 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
0answers
189 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
0answers
38 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.
1
vote
0answers
124 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
1answer
191 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 ...
1
vote
1answer
389 views

Cannot read property 'get' of undefined

I have created a custom js for customer add form. But I am getting the error "can not read property 'get' of undefined" in console. Please help. Thanks in advance. Vendor/CustomCustomer/view/base/...
1
vote
1answer
332 views

How to use owl carousel using require js in magento 2

Anyone can help me out how to use owl carousel using a custom theme by using require js I have downloaded owl carousel zip file from an official website. I want to use this owl carousel in my block ...
1
vote
1answer
413 views

Uncaught Error: Mismatched anonymous define() magento 2.2.4

Below is the console erros is getting in frontend. Checked .htaccess in pub, pub/static and root all .htaccess are identical to Magento 2.2.4 version. js bundling/minification is enabled and ran ...
1
vote
0answers
30 views

Require JS error mime(text/html) not supported

I have just installed magento with composer and I am facing require js errors in my javascript console and the page in blank. no features are exposed