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.

0
votes
0answers
13 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
23 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
21 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.
0
votes
0answers
21 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
17 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="...
2
votes
0answers
35 views

magento 2 - ui componet grid (Backend)

Can this be achieved in magento 2 Ui Component.
0
votes
1answer
27 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
32 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
27 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
31 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
72 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
15 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
37 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 ...
0
votes
0answers
10 views

I am getting an Mismatched annonymus define mdule() False error in the magento 2.3.0

Hi Sometimes it happens that my page information doesn't displayed anything, but when page reload once the information on the page get displayed. On the cross check of browser consol I am getting an ...
0
votes
0answers
22 views

Magento2 require tage breaks list.phtml page

I am trying to get jquery to work in the list.phtml file . I have jquery working on the product detail page within a this same jquery require tag. However when I put it on the list.phtml file it makes ...
0
votes
1answer
18 views

Passing PHP Variables with requireJS in phtml

On my text.phtml template I'm trying to add js by requirejs but can't get the php variables to pass through with them coming up as undefined. Relevant text.phtml $_option = $block->getOption(); $...
1
vote
2answers
36 views

How to add jquery dependency to jquery.zoom for porto theme js under app/design

The website Magento is 2.1.7. We built a customised theme based on Porto theme. Now our frontend product page has an exception: pub/static/frontend/vendor/theme-name/en_AU/Magento_Catalog/js/jquery....
7
votes
3answers
268 views

Magento 2 Advanced Js Bundling

Can any one worked on Advanced JS Bundling? We would like to apply this concept to one of our client projects. Could you please explain about Advanced JavaScript bundling in detailed step by step &...
2
votes
2answers
74 views

Magento 2 CSS/JS error in frontend and backend

It first started after i set https://(My_Domain_Name).com into Configuration > Web > Base URLs & Base URLs (Secure) > Base URL for Static View Files & Secure Base URL for Static View Files (I'...
1
vote
1answer
29 views

magento 2 remove root lib/web/ js files from home page

Magento 2 sends around 300 request on home page so speed is very slow. Also, bundling create very large file so its taken time to load resources. I want to remove js from root lib/web from home page. ...
0
votes
1answer
34 views

magento 2 how to override select-shipping-method.js

when trying to override select-shipping-method.js in my custom module then getting this errors 1 - Uncaught Error: Script error for: Xyz_Customcheckout/js/model/quote http://requirejs.org/docs/...
0
votes
2answers
61 views

Ves Image Slider require.js issue in Magento 2.3

After installing Ves Image Slider on my magento 2.3 project, my backend WYSIWYG stops running on block edit page . and gives error of require.js like given below. When i disable the module, it works ...
1
vote
1answer
59 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/...
2
votes
1answer
17 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/...
0
votes
0answers
61 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....
3
votes
3answers
38 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 ...
0
votes
0answers
34 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 ...
1
vote
3answers
249 views

How to get data-mage-init config in our custom magento jquery widget?

I am currently creating custom jquery widget for owl-carousel just to learn how to do it properly in magento-2. I have configured my own module in requirejs-config.js at theme level. var config = { ...
0
votes
0answers
16 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
2answers
68 views

Loading external JS using requireJS in Magento2

Following this answer I try to add an external JS file named Pym.js to my Magento 2.3 shop. I've tried several things but can not get it to work. My current setup it: app/design/frontend/vendor/...
2
votes
1answer
66 views

How to pass variable from phtml and how to get variable in require js file

How to pass parameter form .phtml to require js file Template file <script type="text/javascript"> require(['Namespace_Module/js/custom'], function () { }); </script> JS ...
0
votes
1answer
51 views

Magento 2 Stuck on Checkout page

I am using magento 2.2.3. And my issue is, on frontend I am getting below errors which stucks checkout page. Means, Page Loader is continuosly loading on checkout page so customer can not do anything :...
2
votes
0answers
65 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 ...
5
votes
3answers
1k views

Custom javascript not working

I'm trying to inject a scroll to anchor javascript globally in Magento 2. More specifically this script: $('a[href^="#"]').on('click', function(event) { var target = $(this.getAttribute('href'));...
1
vote
1answer
137 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
69 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 ...
0
votes
1answer
37 views

How can I use Highcharts graphs in magento2 custom module customer account section in the standard/recommended way with require js?

I need to use the Highcharts.com simple line graph by adding its library with requirejs-config.js in frontend luma theme, custom module in customer account section. I have tried these solutions but ...
0
votes
1answer
137 views

Magento 2 : Use of shims in requirejs-config.js file

Can anyone explain me what is the use of shims dependencies in requirejs-config file? Doing much of research but I hasn't found exact answer for this.
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/...
1
vote
0answers
24 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
2
votes
0answers
29 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 ...
1
vote
1answer
66 views

Magento2 : Using RequireJS module conditional of whether it exists

It is possible to use RequireJS to inject some modules into a custom script, for example: define([ 'jquery', 'tinymce', 'Magento_Ui/js/modal/modal' ], function($, modal, tinymce) { "...
0
votes
1answer
95 views

Magento 2 : How to fire custom ajax before add to cart ajax fire in product detail page?

I have created custom extension and how to fire custom ajax before add to cart ajax fire in product detail page from my custom module. I don't want to override js in theme level. please suggest any ...
2
votes
0answers
75 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 ...
1
vote
1answer
63 views

Magento 2 : How to put custom text in form validation?

I have this message when i validate post code How to change it? I tried overriding postcode-validator.js define([ 'jquery', 'mageUtils', 'Magento_Ui/js/model/messageList'], function ($, utils, ...
3
votes
0answers
232 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.
0
votes
1answer
27 views

Windows separator issue when upgrade Magento from 2.2.5 to 2.3

ERROR: Invalid template file: 'C:/xampp/htdocs/Project/vendor/magento/module-theme/view/frontend/templates/page/js/require_js.phtml' In module: '' block's name: 'require.js'
0
votes
1answer
28 views

my 2.2.6 magento checkout page do not display firstname,postcode,and telephone input field

My current version is magento 2.2.6 and i am facing a strange issue. My checkout page do not display firstname,postcode,and telephone input field on checkout page. whenever i try to place order ...
0
votes
1answer
70 views

map js url not loading magento2

we have a site that was running fine, we just move site to new instance and got an error. All js file's map urls, that we define in require-config.js file not loading on frontend. Like, we define - ...
0
votes
1answer
83 views

Requirejs-config.js not working for parent theme's responsive.js file

I would like to change the values for the media property for the files menu.js & responsive.js from media: '(min-width: 768px)' to media: '(min-width: 992px)'. I thought using Magento's JS Mixin ...