Why Nostr? What is Njump?
2023-10-03 13:47:21

librenews on Nostr: I've set up a node project - Installed NDK - Looks fine on the server side. Can ...

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
Author Public Key
npub1vm7u7lzc0589m3snfpt3k5a4p4agu0t4xj5kpupzfj929ffw9yfqx63wvs