//= require jquery

(($) => {
  $(() => {
    $('.external-component').each((e) => {
      let $el = $(e.target);

      $.ajax({
        type: 'GET',
        url: $el.data('external-src'),
        xhrFields: {
          withCredentials: true
        }
      }).then((html) => $el.replaceWith(html));
    });
  })
})($.noConflict(true));

@@ -70,16 +70,19 @@
 ).each((
+_, 
 e) =%3E %7B%0A
@@ -104,15 +104,8 @@
  $(e
-.target
 );%0A%0A

jQuery.each's first arg is index