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.

Filter by
Sorted by
Tagged with
0
votes
1answer
33 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
303 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
30 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
79 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
475 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....
9
votes
2answers
4k views

Magento 2 Advanced Js Bundling

Can anyone work 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
476 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
74 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
1k 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
3answers
443 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
609 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
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/...
3
votes
3answers
419 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
3answers
6k 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
1k 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
368 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
241 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 :...
4
votes
0answers
362 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
4k 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
386 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
626 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
2answers
307 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
623 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
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/...
1
vote
0answers
31 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
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 ...
1
vote
1answer
274 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
441 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 ...
4
votes
2answers
467 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
186 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
720 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
57 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
82 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
240 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
271 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 ...
0
votes
0answers
123 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 ...
0
votes
2answers
526 views

How to hide particular admin form field(UI Component) based on the value of select field?

I used the following script to hide/show 'schedule_date' based on select field option change, and it is working fine. But I want to hide/display the fields without changing the select field options. ...
0
votes
1answer
84 views

Magento 2.1.9 - Cannot seem to overwrite JS comonent template in custom module

Having trouble trying to overwrite a JS component template at checkout. Here is my module structure and code for this specific task: app/code/MY/MODULE/view/frontend/layout/checkout_index_index.xml &...
1
vote
1answer
172 views

Use of non-amd jquery plugins with requirejs without modifying them?

I recently searched a lot on use of non-amd jquery code with requirejs but couldn't find a proper way to do it. To be more specific, I want to use pana-accordion.js found at below mentioned url. ...
0
votes
1answer
214 views

How to create auto call javascript multiple function in magento 2 in single file

I create two js file for a task. I want to merge two file task in one file in three function. Both two have different config parameter. I am using magento x init. <script type="text/x-magento-init"...
1
vote
2answers
277 views

Having trouble overwriting JS component in minicart dropdown

Having a tough time trying to overwrite the JS component and template around the product image in the minicart dropdown.Here's what I am trying to achieve: I have a custom Product Type depending on ...
1
vote
2answers
3k views

Module JS - Mismatched anonymous define module

I've tried adding my module JS file to Magento2 but for whatever reason it seems to return this error: Error: Mismatched anonymous define() module: function($) My view/frontend file structure: |-...
1
vote
2answers
1k views

Magento 2 How to override adminhtml Js components

Basically I want to override grid.js component file in Magento 2 Require config view/adminhtml/require-config.js Require config code. var config = { map: { '*': { ...
1
vote
0answers
16 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 ...
2
votes
1answer
267 views

jquery plugin error “Uncaught TypeError: $(…).[plugin function] is not a function”

I am using Magento 2.2.6 and I am trying to include a jquery plugin (stickybits, in this case). The jquery plugin file is successfully called in my requirejs-config.js file and I can see that the file ...
0
votes
0answers
356 views

Magento 2 how to write in data-mage-init

Magento uses below way to show Requistition list using "x-magento-init". <div class="block block-requisition-list social-button" data-bind="scope: 'requisition_ - 111'"> <!-- ko template: ...
0
votes
1answer
961 views

Trying to override magento2 product view breadcrumbs

So i tried to change the breadcrumbs.html JS template for magento 2.3 product view breadcrumbs in <themedir>/Magento_Theme/web/templates/breadcrumbs.html, but ive been stuck on this for half a ...
3
votes
1answer
353 views

Fresh Magento 2.3 Resource Files Not Working After Installed in Windows

Fresh Magento 2.3 installed in windows, after resource check and completed everything successfully installed, then if i open my website i am getting error like,
1
vote
1answer
35 views

Require.js errors after database restore

On Magento 2.2.6 I restored from an earlier database. After doing that I flushed the cache, reindexed the site,and deployed static content. I now get require.js errors on every page. On my category ...
2
votes
1answer
103 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 2
3
4 5
10