diff --git a/core/modules/block/custom_block/custom_block.libraries.yml b/core/modules/block/custom_block/custom_block.libraries.yml
new file mode 100644
index 0000000..281a808
--- /dev/null
+++ b/core/modules/block/custom_block/custom_block.libraries.yml
@@ -0,0 +1,5 @@
+drupal.custom_block:
+  version: 1.0
+  js:
+    custom_block.js: {}
+
diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockFormController.php b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockFormController.php
index 4ad8ba9..09cb0ec 100644
--- a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockFormController.php
+++ b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockFormController.php
@@ -140,9 +140,6 @@ public function form(array $form, array &$form_state) {
       '#attributes' => array(
         'class' => array('custom-block-form-revision-information'),
       ),
-      '#attached' => array(
-        'js' => array(drupal_get_path('module', 'custom_block') . '/custom_block.js'),
-      ),
       '#weight' => 20,
       '#access' => $block->isNewRevision() || $account->hasPermission('administer blocks'),
     );
@@ -173,6 +170,8 @@ public function form(array $form, array &$form_state) {
       '#description' => $this->t('Briefly desribe the changes you have made.'),
     );
 
+    $form['#attached']['library'][] = array('custom_block', 'drupal.custom_block');
+
     return parent::form($form, $form_state, $block);
   }
 
