1

I simply want to add js for my custom module but I'm getting this error:

layout.js:137 Uncaught TypeError: Constr is not a constructor

The hello.js file will still work, console.log will still work, however, I still get the error above. Any idea?

requirejs-config.js

var config = {
map: {
    '*': {
        emlhello          : 'EML_CityAutocomplete/js/hello'
    }
}};

hello.js

define([
    "jquery"
], function($){
    "use strict";
    console.log('asdasd');
   return true;
})

And I'm trying to call it via layout xml

<referenceBlock name="checkout.root">
        <arguments>
            <argument name="jsLayout" xsi:type="array">
                <item name="components" xsi:type="array">
                    <item name="checkout" xsi:type="array">
                        <item name="children" xsi:type="array">
                            <item name="autocomplete" xsi:type="array">
                                <item name="sortOrder" xsi:type="string">0</item>
                                <item name="component" xsi:type="string">EML_CityAutocomplete/js/hello</item>
                            </item>
                        </item>
                    </item>
                </item>
            </argument>
        </arguments>
    </referenceBlock>
2
  • Have you check magento.stackexchange.com/questions/117007/… ? Commented Sep 27, 2018 at 6:39
  • I'm certain that I'm using define instead of require, and I'm certain that module-checkout-agreement has nothing to do with it as the error won't show up if I disable the module. Upon doing some trial and error, it seems that i has something to do with <item name="autocomplete" xsi:type="array"> For some reason "autocomplete" does not exist and I'm not sure on how to declare it.
    – Eric Libay
    Commented Sep 28, 2018 at 1:30

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.