-
Notifications
You must be signed in to change notification settings - Fork 961
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
Use query-string instead of qs #121
Comments
I do see that requiring just the mode you want can reduce it, checking that out. |
We could also probably save some space in our production build by putting some of our warnings inside |
We should use https://github.com/facebook/fbjs/blob/master/scripts/babel/dev-expression.js (or an equivalent) for that, IMO. |
@taion That looks interesting, but I've never used it. How does it work? |
It's what React itself uses. It's a Babel plugin that does the following 3 things:
The caveat is that when you build an application from the CJS modules, you'll have to use |
With #124, it's dropped the minified size. I think that's the best we can do without dropping |
There is some interesting conversation about the future of In the comments, @HenrikJoreteg mentions that he has started using https://github.com/sindresorhus/query-string for its lightness.
|
As it stands right now, the size of the UMD bundle is not an accurate gauge of the size of the library, since in practice you'd only want to use a single history (instead of all of them). Ultimately what we want is a way to not force users to bundle the default handlers, but that's as much an issue going from React Router to history (e.g. not always bundling createHashHistory). I'm going to close this for now because I don't think there's anything to actively track here. |
+1 for moving to query-string. @taion that is true in but doens't change the fact that qs is still the largest part of the bundle and the bundle itself is pretty big for what should be a small part of your app. Personally, I just am using history as a cross browser polyfill for pushState because history.js seems outdated. This seems like a reasonable use case, and I think advocates for using the lightest possible qs parser. |
I understand what you're trying to do, but for your use case, using a custom bundle that uses only the type of history that you are actually using is going to save you a lot more space than our dropping It definitely seems worth considering using |
I just jumped in here to suggest switching to Size aside, the maintainers of At the moment TL;DR |
A few points here:
The big open question to me is this - Because we always define default query string serialization and deserialization per https://github.com/rackt/history/blob/v1.13.1/modules/useQueries.js#L5-L11, your built package will always include any dependencies we need for the default handler. Is there any good way to get around this while still offering a reasonable, user-friendly default?The same question comes up for |
Well, never mind, looks like |
I'm 👍 for moving to query-string. I think the hapi team is pretty squarely focused on node. It's been a struggle to get qs to support browsers properly and I've had to contribute a few PRs there. |
I'd recommend against this, @natew. You can definitely build a cross-browser polyfill on top of history, but our goal here is to just create something that works, not a proper polyfill. |
I don't think so, @taion. The best we can do is to make it as light as possible. |
Saves bytes, as done by rackt/history: remix-run/history#121
Just noticed that history is 60k before minification!
The text was updated successfully, but these errors were encountered: