Attach library to custom form
You need to attach library in your hook_form_alter():

/**
* Implements hook_form_alter().
*/

function &lt;YOUR_MODULE_NAME&gt;_form_alter(&amp;$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id){

    /*Attach library, for Blazy implementation you will need
       $form['#attached']['library'][] = 'blazy/load';
    */
    $form['#attached']['library'][] = '&lt;YOUR_THEME_NAME&gt;/&lt;library_name&gt;';
    $form['#attached']['library'][] = '&lt;YOUR_MODULE_NAME&gt;/&lt;library_name&gt;';
    /*Pass even variable from this function to JS settings*/
    $form['#attached']['drupalSettings']['&lt;YOUR_MODULE_NAME&gt;']['&lt;route_name&gt;'] ['variable'] = 'PHP Value To JS';

    return $form;
}


If you pass variable with above mentioned method - $form['#attached']['drupalSettings']['&lt;YOUR.... then that variable will be available in your JS file. 

(function ($, Drupal, window) {
  Drupal.behaviors.helpers = {
    attach: function (context, settings) {
      'use strict';

       console.log(settings);
       console.log(settings.variable); //Should log variable value
    }
  };
})(jQuery, Drupal, window);


Add javascript to form by module