When I import NDK I keep getting this error:
Uncaught SyntaxError: Cannot use import statement outside a module
What is a module? What am i doing wrong? 🙂
#asknostr
When I import NDK I keep getting this error:
Uncaught SyntaxError: Cannot use import statement outside a module
What is a module? What am i doing wrong? 🙂
#asknostr
It’s hard to say without knowing exactly what you’re doing. ChatGPT is great for helping you with this kind of stuff.
import statements cannot be used in normal javascript functions you embed in HTML,without doing something called modularization.
Depending on your situation, one of the examples in this page can help you - https://www.w3schools.com/js/js_modules.asp
If you are running in nodejs, you might want to start with a `npm init` command, add ndk using `npm add ...` command suggested by ndk and then write your code in the index.js file, then run as `node index.js.`
Good luck with NDK BTW :)