Skip to content

[2.x] Don't import pusher-js in the React, Vue and Svelte wrappers - #573

Closed
raghavji2050 wants to merge 1 commit into
laravel:2.xfrom
raghavji2050:fix/optional-pusher-js-wrappers
Closed

raghavji2050 wants to merge 1 commit into
laravel:2.xfrom
raghavji2050:fix/optional-pusher-js-wrappers

Conversation

@raghavji2050

Copy link
Copy Markdown

pusher-js is an optional peer of the wrappers, but each one imported it at the top of the config module. That means the package fails to load unless pusher-js is installed, even when you're only using Mercure, Socket.IO, or the null broadcaster.

I dropped that import so the wrappers follow laravel-echo itself: pass the client in configureEcho, or set window.Pusher. The README examples now show passing it. Apps that aren't using Pusher or Reverb no longer need the dependency.

Fixes #570

It is an optional peer dependency, so the wrappers should load without it
when a non-Pusher broadcaster is used. Pusher and Reverb users can pass
the client in configureEcho or via window.Pusher, same as laravel-echo.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

React, Vue and Svelte wrappers import pusher-js unconditionally, although it is an optional peer dependency

2 participants