I have a library in JS
at this path in a module.
magento2\app\code\vendor_name\module_name\view\frontend\web\script.js
And it is initialised to the header with the following code:
checkout_index_index.xml
<script src="Roman_hello::js/view/hello-init.js"/>
</head>
And require-config.js
file in
vendor_name\module_name\view\frontend
with the following code:
var config = {
map: {
'*': {
lazyloadScript:'vendorname_modelname::library/dist/libscript.min.js'
}
}
};
And on click i call the initialised library to the default.js at this path.
vendor_name\module_name\view\frontend\web\js\view\payment\default.js
but as always this gives error default.js:31 Uncaught (in promise) ReferenceError: default_var is not defined at default.js:31
what thing am I missing?