inertiajs / inertia

Inertia.js lets you quickly build modern single-page React, Vue and Svelte apps using classic server-side routing and controllers.
https://inertiajs.com
MIT License
6.3k stars 423 forks source link

feat: smaller alternative for `qs` -> `query-string` #1792

Closed SergkeiM closed 7 months ago

SergkeiM commented 7 months ago

Hi @reinink

The purpose of this PR is to reduce the size of @inertiajs/core.

Starting from version qs@6.10.0 increased size by 60%

If we check the size of @inertiajs/core

12% - belongs to qs (9.8kB min + gzip - 31.3kB min)

I believe this is a lot for simple helper to build URL query.

In this PR:

qs is replaced by query-string (2.5kB min + gzip) x4 smaller then qs, but does the same thing.

jamesh-purr commented 7 months ago

@jessarcher @reinink When do we think this could be looked at and potentially merged? I need this issue resolved asap and if this does indeed resolve the issue without any problems then I am +1 on getting this merge asap.

reinink commented 7 months ago

Hey! Thanks for this suggestion, but I think we're going to stick with qs for now because this is just too risky of a change as there could be unexpected side effects for not a lot of gain. Might revisit this in the future, but for now going to leave it as is 👍

SergkeiM commented 7 months ago

Hi @reinink as mentioned #1791 here we can release a beta or pre-release for people to test.

I would actually replace both libraries with just UrlSearchParams

For my case the size was very important, so I unded up creating a custom build, I've also replaced axios with alova.js is a fetch based lightweight request strategy library that supports upload progress.

jamesh-purr commented 7 months ago

Hey @reinink

To add to this, you say its not a lot of gain but there is a clear issue with the package being not optimised/needs improving its size.

I have opened a issue regarding this here - https://github.com/inertiajs/inertia/issues/1804

Google simply don't like the package size and is a factor in its rating on your site which affects performance and seo being that if the score in lower than it should be.