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.

201 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
8
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
501 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
390 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
2answers
352 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 ...
3
votes
0answers
46 views

magento 2 - ui componet grid (Backend)

Can this be achieved in magento 2 Ui Component.
3
votes
3answers
430 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
31 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
764 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
195 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
743 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
648 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
763 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
190 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
435 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
0answers
202 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 ...
2
votes
1answer
158 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
45 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
33 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
46 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
109 views

How to add a configurable external JS with additional data- attributes via requirejs?

I was trying to add an external JS, say https://foo.bar/script.js (the url is configurable via config data) via requirejs, and I was successful so far. But then I realized that I would need to provide ...
2
votes
1answer
372 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
532 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
183 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
48 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
1answer
4k views

Magento 2: Uncaught Error: Script error for: smartmenus

I am trying to implement the navigation menu with Bootstrap Smartmenus but the theme does not pick up the javaScript. Can somebody help me out? Vendor/Name/requirejs-config.js var config = { map: {...
2
votes
0answers
653 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
273 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
162 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
107 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
1answer
1k views

Magento 2: Adding external CSS and JS to only one content page, and use jquery functions inside the content

I am trying to add some dynamic function to one content page of a Magento 2 site, but didn't manage to do it. Here is what I thought: 1) Adding the external javascript files at the "Layout Update XML"...
2
votes
0answers
757 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
684 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 ...
1
vote
0answers
31 views

RequireJS module 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 ...
1
vote
0answers
23 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
16 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
20 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
28 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
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
42 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
40 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
25 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
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 ...
1
vote
0answers
90 views

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

How to use if / else condition in html template file ?
1
vote
1answer
49 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) ...

1
2 3 4 5