We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2dd5f72 commit df258cbCopy full SHA for df258cb
packages/components-vue/src/composables/uuid.ts
@@ -12,8 +12,12 @@ export default function useUIID() {
12
// this should fail in node
13
self.crypto || window.crypto;
14
} catch (error) {
15
- // inject crypto into the global scope
16
- global.crypto = global.crypto || require("crypto");
+ try {
+ // inject crypto into the global scope
17
+ global.crypto = global.crypto || require?.("crypto");
18
+ } catch (error) {
19
+ console.log("cannot define crypto");
20
+ }
21
}
22
23
return { uuid: nanoid };
0 commit comments