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

correct browser detection #1135

Merged
merged 1 commit into from
Jul 30, 2020
Merged

correct browser detection #1135

merged 1 commit into from
Jul 30, 2020

Conversation

nosovk
Copy link
Contributor

@nosovk nosovk commented Jul 30, 2020

currently webpack based projects couldn't import mqtt.js because incorrect browser detection.
It's not a problem for react, where node-shims enabled, but a pain for angular (where enabling node-shims isn't supported officially)
To fix that issue we need to check if process exists (it will be not available in browser)
Also due to shims in webpack we need to check are we in process of bundling, or not.

currently webpack based projects couldn't import mqtt.js because incorrect browser detection.
It's not a problem for react, where node-shims enabled, but a pain for angular (where enabling node-shims isn't supported officially)
To fix that issue we need to check if `process` exists (it will be not available in browser)
Also due to shims in webpack we need to check are we in process of bundling, or not.
@YoDaMa
Copy link
Contributor

YoDaMa commented Jul 30, 2020

@nosovk is this PR finished?

@nosovk
Copy link
Contributor Author

nosovk commented Jul 30, 2020

yes, this one is done. Thanks

@YoDaMa YoDaMa merged commit eedc2b2 into mqttjs:master Jul 30, 2020
@ghost ghost mentioned this pull request Aug 13, 2020
PremiumBurger pushed a commit to quickstar/MQTT.js that referenced this pull request Nov 27, 2020
)

currently webpack based projects couldn't import mqtt.js because incorrect browser detection.
It's not a problem for react, where node-shims enabled, but a pain for angular (where enabling node-shims isn't supported officially)
To fix that issue we need to check if `process` exists (it will be not available in browser)
Also due to shims in webpack we need to check are we in process of bundling, or not.
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

Successfully merging this pull request may close these issues.

None yet

2 participants