Skip to content
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

Consider getting rid of mobile-detect as a dependency on the client. #883

Closed
aickin opened this issue Feb 22, 2017 · 3 comments
Closed

Consider getting rid of mobile-detect as a dependency on the client. #883

aickin opened this issue Feb 22, 2017 · 3 comments

Comments

@aickin
Copy link
Contributor

aickin commented Feb 22, 2017

I was curious how big the basic bundle is, so I ran an webpack-bundle-size-analyzer on Homepage.js from the basic react-server yo scaffold. I posted the results here. The file sizes shown are minified, ungzipped.

There are a few interesting things, but the thing that most sticks out to me is the amount of space mobile-detect takes: 36.2kB out of 307kB, or 11.8%.

As far as I can tell, mobile-detect is only used to see if the user is mobile/phone/tablet. If that's right, it'd probably be better to figure out a way to run mobile-detect on the server and then just send down the string "mobile"/"phone"/"tablet", while excluding mobile-detect from the client build. Thoughts?

@gigabo
Copy link
Contributor

gigabo commented Feb 22, 2017

run mobile-detect on the server and then just send down the string "mobile"/"phone"/"tablet",

@aickin Ooh! Good idea! I think we're currently exposing a full mobile-detect instance, so that would probably be a breaking change. Or maybe... we could send down a thin dummy that implements the interface with values hard-coded by the server? 🤔

@ptomasroos
Copy link
Contributor

I think this is a great idea. Every page starts with a response form the server, moving as many bits as possible and letting the output be a bool just nails it.

@gigabo
Copy link
Contributor

gigabo commented Sep 13, 2017

This is addressed by #950 which landed in [email protected].

@gigabo gigabo closed this as completed Sep 13, 2017
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

No branches or pull requests

3 participants