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
2answers
562 views

How to use Datatable js library in magento 2?

what's the best way to use the datatable js library in my template file ? I tried like this but it doesn't work : layout file: <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="...
0
votes
1answer
462 views

Magento2 Require js not a function

When running grunt exec require.js not a function error appeared.
1
vote
1answer
844 views

Magento 2:- How to create Vertical or Horizontal tagging with Tabs widget

I tried to create tabbing using Tabs widget but It does not display what i want. I follow this Link:- Tab widget and Building Tabbed Interface with Magento 2 Javascript UI Widget/Modal/view/frontend/...
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
2
votes
2answers
635 views

Magento 2.2 Add Masonry JS

I've a problem to include Masonry JS to my Magento 2.2 I've a custom theme in app/design/frontend/CustomVendor/CustomTheme In this folder I've a web/ folder and inside I've requirejs-config.js var ...
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
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 ...
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="...
0
votes
1answer
869 views

jQuery version update at M2

I want to upgrade magento 2 jQuery version from 1.9 to 3 do you think is an good idea? how i do it for upgrade jquery build-in file who come with magento 2 ?
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: { ...
0
votes
1answer
1k 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: {...
1
vote
1answer
31 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 ...
1
vote
2answers
4k views

Uncaught SyntaxError: Unexpected token } in JSON at position 199

I tried to add a main.js to my Magento theme using the answer on How To add JS file in frontend for all pages, however, it caused issues so I removed this, however, I still get console error for this. ...
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 $....
7
votes
1answer
1k 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....
2
votes
4answers
71 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
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
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 ...
7
votes
3answers
267 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 &...
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 ...
2
votes
1answer
1k 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 ...
8
votes
4answers
22k views

Use require-config.js to load files needed on all pages

I know how to use require-config.js in custom theme, but I would like to use custom javascript file (myfile.js) on all pages. In which directory should I add require-config.js and how to use it, so ...
0
votes
1answer
1k views

Slick JS dose not work on magento 2 when loaded from require JS

There is no error in console and when I tried to put the log "Slick is on "on the on-init function, it displayed correctly. My theme require-config js : var config = { deps: [ "js/mainsite", ...
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(); $...
4
votes
2answers
4k views

require.js error on Magento 2

And because of this error, sometimes the cart and checkout pages don't load properly. Any clue how to fix this? I've already tried to regenerate the pub/static folder, but it's still the same. Thanks ...
1
vote
2answers
35 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....
2
votes
2answers
73 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'...
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: ...
0
votes
1answer
1k views

Sending variable to a bootstrap modal

I have seen this asked before but a lot of the answers I found where people looking to get a variable into a modal to query a database. However thats not what I want. I just want to send a variable ...
2
votes
2answers
908 views

Magento2 RequireJS CustomerData is empty at page load, but populated once page finishes loading?

I'm trying to access some data stored in the Magento_Customer/js/customer-data object I have the following files: --- garage.js --- define([ 'Magento_Customer/js/customer-data' ], function(...
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. ...
1
vote
3answers
248 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
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 ...
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
195 views

How do I add a custom message on magento's checkout page(right below the Country selector) based on the country that user selects to ship the product?

For example: If a user wants to ship to India, I want to show a small message below the country selector and before the shipping method saying that "custom duties and taxes has to be paid by customer"....
2
votes
4answers
2k views

Magento 2 : Add custom js to a single CMS page

I am trying to add custom js to a single CMS page in Magento 2.2.5. Here is what I got: I have put the rellax.min.js file at :/app/design/frontend/TemplateMonster/md/web/js And I want to use that ...
0
votes
4answers
1k views

Magento 2: add js file, but I can't find my file in static folder

I add js file in my module using the requirejs, but the requirejs can't load the file and i get this error: require.js:1895 GET (my_ip)/magento2/pub/static/frontend/Magento/SaturTheme/it_IT/...
0
votes
1answer
144 views

Use cases for different JS init methods

I have read a number of ways to add JS files to a Magento 2 project, but I haven't seen anywhere where the benefits / best use-cases for each are explained. The use-cases that are most relevant to my ...
0
votes
1answer
364 views

Magento 2: get masonry working / source file path

Magento2 is installed via composer I've written a custom theme, based on luma masonry is installed via bower - the bower_components folder is placed in: app/design/frontend/VENDOR/MY_THEME/web I've ...
2
votes
0answers
731 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
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
1answer
1k views

Can Not View Content Blocks due to require.js error - Magento 2 theme change

I am facing problem with require.js on Magento 2 theme change Content > Blocks The page shows endless spinner and I can never view my imported blocks for my new theme. When I do Firebug on the page. ...
0
votes
0answers
59 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....
1
vote
1answer
4k views

Unable to resolve the source file for error in custom theme?

I am working on magento version 2.1.3 and have a custom theme shoppersbay. For some js files it gives error like Unable to resolve the source file for 'frontend/Smartwave/shoppersbay/en_US/...