I have created a custom theme in app/design/frontend/Vendor/Themename
In theme directory I have Themename/requirejs-config.js
var config = {
deps: [
"js/custom",
]
};
Themename/web/js/custom.js
require([
'jquery'
], function ($) {
console.log('adsa');
console.log(config);
});
I have a phtml file included and I am passing php variable to external js
<script type="text/x-magento-init">
{
"*": {
"js/custom": {
"contacturl": "<?php echo $block->getUrl("contact/index/post"); ?>"
}
}
}
</script>
This is the error I am getting Config is not defined.
I am in the developer mode What I tried
Cleared Cache
Cleared Var Directory
custom
JS code and I presuming that you are trying to passcontacturl
tocustom
JS.