From 19350ce9b1a28ac477fa81f9b1656aa8951e6d4d Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Sun, 2 Mar 2025 15:07:38 -0500 Subject: [PATCH] Code split Echo and Pusher --- resources/js/components/Echo.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/resources/js/components/Echo.js b/resources/js/components/Echo.js index 21bb1e64af..3d4db10a9f 100644 --- a/resources/js/components/Echo.js +++ b/resources/js/components/Echo.js @@ -1,7 +1,3 @@ -import LaravelEcho from 'laravel-echo'; -import Pusher from 'pusher-js'; -window.Pusher = Pusher; - class Echo { constructor() { this.configCallbacks = []; @@ -16,7 +12,14 @@ class Echo { this.bootedCallbacks.push(callback); } - start() { + async start() { + const [{ default: LaravelEcho }, { default: Pusher }] = await Promise.all([ + import('laravel-echo'), + import('pusher-js'), + ]); + + window.Pusher = Pusher; + let config = { ...Statamic.$config.get('broadcasting.options'), csrfToken: Statamic.$config.get('csrfToken'),