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

Client-side support #9

Open
elessarperm opened this issue Feb 15, 2018 · 8 comments
Open

Client-side support #9

elessarperm opened this issue Feb 15, 2018 · 8 comments

Comments

@elessarperm
Copy link

Hi! I have a problem with running your lib on client side. I need to detect if current browser is supported or not and notify the user if not.
I've tried to compile it with webpack but one of it's dependencies uses native node.js modules (to be more specific it's useragent) and it either not compile or takes a lot of unnecessary code to the bundle. Do you have any workaround how to use your lib in browser? Maybe I'm doing something wrong.

Thanks.

@GabrielDelepine
Copy link
Contributor

GabrielDelepine commented Mar 30, 2018

I guess some dependencies of this project require Node.
It can be interesting to know which one to make it optional

But this repo needs a huge list of browsers to work, I would be worried about the size of the file

Maybe what you are looking for is something like a feature detection package

@elessarperm
Copy link
Author

Feature detection is great but our use-case is to just inform customers that we didn't test our product in their browser yet

@hwclass
Copy link

hwclass commented Jun 8, 2018

Hi guys,

I've tried to run it in a client application bundled via browserify and got the following:

screenshot 2018-06-08 18 16 25

@GabrielDelepine
Copy link
Contributor

this project is not thinked to be executed client side so I wouldn't be supprise if it fails.

if your files-server is built in Node (with express for example), you can run this project server side for choosing different html template based on the browser user's agent

@vidal7
Copy link

vidal7 commented Jun 12, 2018

Including browserlist-useragent in the webpack's bundle adds 400kb gzipped and almost 3mb unzipped. It is definitely not thinked to be executed client side.

@pastelsky
Copy link
Collaborator

This is a issue in an dependency - useragent. It's being tracked here - 3rd-Eden/useragent#129

@piranna
Copy link

piranna commented Jan 4, 2022

I think ideal solution would be to have the browsers list generated on build time from the actual browserslist config as a JSON, and later a runtime module that checks that list with the running browser useragent.

It's not directly related to browserslist itself but a couple of helper packages, one a webpack plugin and another a browser checker. Not sure if they could be combined somehow, but probably they could be hosted under browserslist github organization.

@mizdra
Copy link

mizdra commented Jan 5, 2022

FYI: browserslist-useragent-regexp can generate code to determine if a UA matches. Since this code consists of just a regular expression, it is universal and works in browsers. In addition, it does not include the code for the .browserslist parser, so the bundle size is very small. This makes it very suitable for use in a browser. Maybe this tool will solve your problem.

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

7 participants