Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Create a template file hawksearchjs.phtml, having specified the following:. Specify full or minified version of hawksearch.js file in $jsPath variable

Code Block
languagephp
<?php
use Magento\Framework\View\Element\Template;
use HawkSearch\Proxy\ViewModel\Config as ConfigViewModel;

/** @var Template $block */
/** @var ConfigViewModel $configViewModel */
$configViewModel = $block->getData('configViewModel');
if (!$configViewModel) {
    return;
}
$jsPath = 'includes/hawksearch';//Use value 'includes/hawksearch.min' for minified file version
?>
<script type="text/javascript">
    (function() {
        var config = {
            paths: {
                "HawkSearch_Proxy/js/hawksearch": "<?= /* @noEscape */ $configViewModel->getHawkUrl('includes/hawksearch'$jsPath) ?>"
            }
        };
        require.config(config);
    })();
</script>

...