uuidjs/uuid

UUID Generation in Non-Browser Context (eg. NativeScript)

BallisticPain opened this issue · 2 comments

Is your feature request related to a problem? Please describe.

When I import and use uuid in a NativeScript application I receive an error cannot get 'browser' of undefined. Initially I didn't realize this was related to the UUID library. But the moment I removed attempted v4() generation the application compiled without any errors.

Describe the solution you'd like

I would love to use uuid as per the documentation even when in a mobile device situation such as NativeScript. I saw the ReactNative support and was hopeful. However, upon a quick peek it didn't seem to be a user friendly solution and I didn't want to attempt to port it.

Describe alternatives you've considered

I've looked at guid-typescript, however, it is unmaintained even though it's downloaded 67k+ times per week according to NPM.

Another alternative that I have considered is to write a NativeScript plugin that uses Android / iOS functionality to generate the UUIDs but felt that would only benefit a smaller community.

Additional context

I imagine if the solution were implemented very well it could cross all the non-browser contexts. I'm not certain how feasible this is, but I hope this is the right place to ask.

Thanks for this UUID library!

Duplicate of #314.

@BallisticPain - A Minimal, Complete, and Verifiable example, ⟪cough⟫ as requested in the bug report template ⟪cough⟫ would be helpful. E.g. a small repo that we can clone, with instructions for building and reproducing the error.

@BallisticPain please check my comment in #314 (comment)

If reordering resolve.mainFields doesn't work for you, feel free to reopen this issue and proved an example as outlined by @broofa above.