Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

5
votes
0answers
459 views

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

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 implement are ...
3
votes
0answers
24 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
83 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
307 views

When to use mixins and when to use map?

I'm following magento 2 official documentation to create my checkout step. I'm very new to knockoutjs, requirejs, js components which are massively used in magento 2, specially in checkout. I'm ...
3
votes
0answers
794 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
0answers
149 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
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
25 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
0answers
27 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 ...
2
votes
0answers
90 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.
2
votes
0answers
77 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
20 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
25 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
499 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
562 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 ...
2
votes
0answers
418 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 ...
2
votes
0answers
176 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
135 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
93 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
390 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
23 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 ...
1
vote
0answers
23 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
1
vote
0answers
12 views

Created node doesn't have attachEvent property

After updated magento from 2.1 to 2.3 I've got a require js error in console: Uncaught Error: Script error for: ModuleName I made an investigation and find out that require.js core file in the ...
1
vote
0answers
28 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 ...
1
vote
0answers
508 views

Magento 2 load external script in my custom page

I want to add an external script to my store. I have added the script in my phtml file and it is working fine. But I want to follow the magento EQP validation. Here is my working code my layout xml &...
1
vote
0answers
25 views

how to rewrite magento2 backend menu js

I want to rewrite magento2 js The file path is "vendor/magento/theme-adminhtml-backend/web/js/theme.js", what should i do? Thanks for you helping
1
vote
0answers
88 views

Theme without require.js, knockout.js, AngularJS

I'm evaluating a the moment Magento2 as a solution for our Shop and I looked into a lot of Shops based on Magento2 to test the frontend performance and to be honest, I'm shocked. Every Shop I saw ...
1
vote
0answers
419 views

Magento 2.2.2 - RequireJS domReady! not working with Slick Product Slider

Issue Slick slider breaking/not loading properly on page load and eventually breaking the product slider Solution: Load slick slider script after entire document is loaded and parsed ...
1
vote
0answers
90 views

Magento 2.2 I want to add plyr.js for Vimeo video, I'm getting requirjs error and Class.extend is not a function, how to solve it?

Error 1) Class.extend is not a function. 2)RequireJS Error: Mismatched anonymous define() module: function (_, utils, wrapper) { 'use strict'; 3) I'm getting black screeninsted to Video. ------...
1
vote
0answers
172 views

JQuery gets loaded after script sometimes

I implemented owlcarousel like this <script> require([ "jquery", "Vendor_Module/js/owl.carousel.min" ],function($){ $('#slider').ready(function() { ...
1
vote
0answers
101 views

Uncaught ReferenceError: optionsPrice is not defined

After adding product.options.js in catalog product view i still get the error relating this. I am using configurable swatches with magic tool zoom.
1
vote
0answers
166 views

How to using mixins for “mage/dataPost”?

I try to mixin a widget js file following guide at here. I create a file requirejs-config.js in view/frontend directory. There's view/frontend/requirejs-config.js: var config = { config: { ...
1
vote
0answers
193 views

Shim config to load angular js and dependencies

I have an angular js app which I want to integrate into Magento 2 so I created require-js config like below var config = { paths: { angular: 'Test_Custom/js/angular', ...
1
vote
0answers
237 views

Magento 2 Additional step between shipping and payment in checkout

I created a custom step login in checkout which being my first step I used the below mixins: In requirejs-config.js: var config = { 'config': { 'mixins': { 'Magento_Checkout/js/view/...
1
vote
0answers
134 views

Uncaught Reference Error

I'm getting this error message after an update that the developer of the plugin performed and it seems to be completely broken now. Is there a way I can fix this error myself? Uncaught ReferenceError:...
1
vote
0answers
69 views

requirejs-config.js compiling with wrong code

Magento 2.1.4 with an nginx setup creates an extra line of code in pub/static/_requirejs/adminhtml/Magento/backend/en_US/requirejs-config.js after compiling the static content: require.config({"...
1
vote
0answers
377 views

Add jQuery module to admin form field - Color wheel Magento 2

I need to add a colour picker as a admin form field - I have added what I believe is needed to get the JS working but it's still throwing errors and showing me no form field. The color picker I'm ...
1
vote
0answers
163 views

Where can i use $('#elementId').trigger('contentUpdated') and how?

I have added my script as follows in template : <script type="text/x-magento-init"> { "*":{ "Vendor_Module/js/myscript":{ "baseUrl": "<?php echo $quickshopHelper->...
1
vote
0answers
606 views

How to initialise a carousel and use Knockout observables in the same JS file

I'm experimenting with Require JS and Knockout JS in Magento 2 and I've ran into a strange problem where I can't use Knockout JS and initialise a carousel in the same JS file. The carousel works fine ...
1
vote
0answers
851 views

Callback on method for KO JS observable data after AJAX completion

I have a module that modifies the product prices on the catalog pages and needs to bypass the cache. My issue is that I've defined these classes and need to trigger their flush method once another ...
1
vote
0answers
73 views

How to replace load jquery.js form local to link web CDN in require.js

When my page load require.js required jquery.js from local https://mypage/pub/static/frontend/../../en_US/jquery/jquery.min.js And I want to change required from link web CDN https://ajax....
1
vote
0answers
120 views

How do include a lot of JS in Magento 2 from a flat design

I am working on adapting a third party JS heavy flat design into Magento 2. I have mostly what I need HTML wise moved around via XML instructions for my home page. Now that everything is in order ...
1
vote
0answers
79 views

How opinionated is magento2 frontend(JS)?

I hope this question makes sense, there is a chance it doesn't. I am looking into creating a custom checkout module for Magento2 and as a part of it i am evaluating JS frameworks. After evaluating ...
1
vote
0answers
720 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 ...
1
vote
0answers
238 views

required error in magento2?

in magento2 add custom.js file file custom.js require( [ 'Mageaddons_Popup/js/angular.min', 'Mageaddons_Popup/js/textAngular-rangy.min', 'Mageaddons_Popup/js/textAngular-...
1
vote
0answers
198 views

Magento 2 RequireJs callback not called

I have the following in requirejs-config.js var config = { "map": { "*": { "jquery/easing": "./js/jquery.easing.1.3", "jquery/mobile/customized": "./js/jquery....
0
votes
0answers
15 views

JS Error after adding bootstrap 4.3.1 files in magento 2 custom theme

ERROR Uncaught TypeError: jQuery.ajaxSetup is not a function at jquery-migrate.js:301 at jquery-migrate.js:521 (anonymous) @ jquery-migrate.js:301 (anonymous) @ jquery-migrate.js:521 require....
0
votes
0answers
25 views

Override RequireJs Config

So as we all know Magento has always had a massive js overhead, I'm trying to reduce some of this by removing some unnecessary scripts. I know how to override a script or extend one, but how do I ...
0
votes
0answers
6 views

Masonry with ImagesLoaded and InstagramFeed

So i am trying to implement Masonry to Mageplaza InstaFeed Widget into a CMS page, but the code generated by the feed do not get Masonry working. Since If I copy the generated code once again into the ...
0
votes
0answers
35 views

Custom live chat script not working in Magento 2.2.4

I have tried adding the chat script on .phtml of the custom extension which I have created for integrating my own live chat. But the libraries are showing undefined when the chat plugin loads the ...