worldcoin / idkit-js

Javascript toolkit to interact with the World ID protocol. Building the Identity SDK.
https://docs.worldcoin.org
MIT License
280 stars 71 forks source link

Is it possible to use in Nuxt.js #138

Open mathxlee opened 1 year ago

mathxlee commented 1 year ago

Hi team, I tried to install the package like this: yarn add @worldcoin/idkit

and then import and init it:

import * as idkit from '@worldcoin/idkit' // If you installed the JS package as a module

idkit.init('idkit-container', {
    enable_telemetry: true,
    app_id: 'app_BPZsRJANxct2cZxVRyh80SFG', // obtain this from developer.worldcoin.org
    action: 'your_signal',
    onSuccess: result => console.log(result),
})

but i got tons of errors from the node_modules:

ERROR in ./node_modules/@radix-ui/react-toast/dist/index.mjs 214:46-59
Can't import the named export 'Branch' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/@radix-ui/react-dialog/dist/index.mjs 101:7-22
Can't import the named export 'Children' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/framer-motion/dist/es/components/AnimatePresence/index.mjs 22:4-12
Can't import the named export 'Children' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/@radix-ui/react-slot/dist/index.mjs 12:26-41
Can't import the named export 'Children' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/@radix-ui/react-slot/dist/index.mjs 21:20-35
Can't import the named export 'Children' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/@radix-ui/react-slot/dist/index.mjs 21:66-81
Can't import the named export 'Children' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/@radix-ui/react-slot/dist/index.mjs 42:11-26
Can't import the named export 'Children' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/@radix-ui/react-slot/dist/index.mjs 42:49-64
Can't import the named export 'Children' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.mjs 8:30-45
Can't import the named export 'Component' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/@radix-ui/react-dialog/dist/index.mjs 249:42-65
Can't import the named export 'DismissableLayer' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/@radix-ui/react-dialog/dist/index.mjs 243:104-121
Can't import the named export 'FocusScope' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/@radix-ui/react-toast/dist/index.mjs 412:46-61
Can't import the named export 'Fragment' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/@radix-ui/react-toast/dist/index.mjs 553:137-152
Can't import the named export 'Fragment' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/@radix-ui/react-dialog/dist/index.mjs 243:46-61
Can't import the named export 'Fragment' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/framer-motion/dist/es/components/AnimatePresence/index.mjs 97:36-50
Can't import the named export 'Fragment' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/framer-motion/dist/es/components/AnimatePresence/index.mjs 156:32-46
Can't import the named export 'Fragment' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/@radix-ui/react-slot/dist/index.mjs 48:46-61
Can't import the named export 'Fragment' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/@radix-ui/react-toast/dist/index.mjs 551:67-80
Can't import the named export 'Portal' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/@radix-ui/react-dialog/dist/index.mjs 103:46-59
Can't import the named export 'Portal' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/@radix-ui/react-toast/dist/index.mjs 289:46-61
Can't import the named export 'Presence' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/@radix-ui/react-dialog/dist/index.mjs 101:81-96
Can't import the named export 'Presence' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/@radix-ui/react-dialog/dist/index.mjs 119:62-77
Can't import the named export 'Presence' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/@radix-ui/react-dialog/dist/index.mjs 157:46-61
Can't import the named export 'Presence' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/@radix-ui/react-toast/dist/index.mjs 234:42-58
Can't import the named export 'Primitive' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/@radix-ui/react-toast/dist/index.mjs 429:42-58
Can't import the named export 'Primitive' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/@radix-ui/react-toast/dist/index.mjs 560:46-62
Can't import the named export 'Primitive' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/@radix-ui/react-toast/dist/index.mjs 572:46-62
Can't import the named export 'Primitive' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/@radix-ui/react-toast/dist/index.mjs 609:42-58
Can't import the named export 'Primitive' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/@radix-ui/react-toast/dist/index.mjs 621:46-62
Can't import the named export 'Primitive' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/@radix-ui/react-dialog/dist/index.mjs 75:46-62
Can't import the named export 'Primitive' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/@radix-ui/react-dialog/dist/index.mjs 139:42-58

...

and there are a lot...

any help will be appreciated.

m1guelpf commented 1 year ago

Are you setting "type": "module" in your package.json?

mathxlee commented 1 year ago

Are you setting "type": "module" in your package.json?

Yes, we have, but still got the same errors and not working.

m1guelpf commented 1 year ago

I think using import idkit from '@worldcoin/idkit/build/idkit-js' instead of import * as idkit should work

btboy12 commented 1 year ago

Does this library support Vue? It looks like it only supports reactjs.

Yokymia32 commented 9 months ago

❤️

vinayakkulkarni commented 6 months ago

I am currently working on adding Vue support – https://github.com/vinayakkulkarni/idkit-js/tree/feat/add-vue-support