-
Notifications
You must be signed in to change notification settings - Fork 109
Remove unused dependencies #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Good find |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right you are. Thanks to Livewire we no longer need Axios.
Appreciate it 👏
I'm a bit curious if Echo would fail if Axios is removed. |
It should not as laravel-echo is not dependant on axios. |
@depsimon did you try with a private channel that would hit the broadcasting authentication route? |
I was curious to follow this thread and did some exploring: Here's the docs for laravel-echo (now under Broadcasting in the main Laravel docs) and it does mention expecting axios to be imported (otherwise the implementor will need to configure sending their own headers). Echo implements a pattern where it registers "third party request interceptors" so it can add the header to each request, and it looks for the existence of Axios (or alternatively, Vue.http, jQuery, or Turbo): https://github.com/laravel/echo/blob/f333d49d116fcd7302d1fd19815b6876ce542085/src/echo.ts#L159 So it's a soft dependency, in a way - and a documented one. If someone is configuring Echo, they will need to use either one of these libraries or send the header themselves. So, by including Axios in the starter kit, it enabled this sort of soft dependency to work for packages like Echo. There's no right answer for what to do here, but it was interesting to follow Taylor's comments and see why Axios might be expected down the line. Since this is a starter kit and there are many steps required in order to configure Broadcasting, there's a case to be made that the axios dependency doesn't need to be enforced in this starter kit and instead the implementor could make their choice down the line if they chose to install Echo. On the flip-side, Axios is useful and may make sense to include as a suggested front-end library, and has the benefit of meeting these downstream soft dependencies (it wouldn't make sense for Echo to depend formally on one of the many front-end libraries, so I understand why it implemented the "check and inject" pattern to play well with whatever the implementor decided. Since it's documented, it's not a huge mystery for those configuring Echo. All that said, if Livewire itself also requires Axios and implements a similar pattern of injecting headers then it makes sense for this starter kit. If that’s the case, where would that be? |
Some more cursory digging, since I've never looked at the Livewire code before I decided to take a peek: Laravel Echo support is framed as optional for Livewire: If Echo is detected ( So it seems like Livewire will play nice with Laravel Echo if the project decides to use it, and the header will be added. Livewire itself uses the native It seems like people would only need to add Axios (or an alternative supported library) if they wanted to install Echo, and since Echo is not configured by default for this starter-kit (and the dependency is documented in the Echo installation guide), Axios could be removed from this project. If there's something else that's undocumented or I am missing something, let me know! |
axios
is not used anymore.I suspect this is a leftover of the original starter kit which uses axios.
autoprefixer
is not used anymore.It was used as as PostCSS plugin, but as it's been replaced by the Vite plugin it's not needed anymore.