I've set up a node project
- Installed NDK
- Looks fine on the server side. Can interact with relays etc.
- I installed webpack and the config is pretty basic
const path = require('path');
module.exports = {
target: 'web',
mode: 'production',
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js'
}
};
I have an entry file like this:
import NDK, { NDKNip07Signer, NDKEvent } from "@nostr-dev-kit/ndk";
- npx webpack successfully creates the bundle (I see refs to NDK in the bundle)
- In a web page I see the bundle being served successfully
- When I try to instantiate in the browser, the console reads :
Uncaught ReferenceError: NDK is not defined
I know it's my setup, not the NDK, but I don't work with JS like this often.
#nostrdev #asknostr