nostr-nsec-seedphrase
Version:
A comprehensive TypeScript library for Nostr key management with BIP39 seed phrases, supporting both ESM and CommonJS. Implements NIP-01, NIP-06, NIP-19, and NIP-26 with key generation, event signing, bech32 encoding/decoding, and secure cryptographic ope
55 lines (52 loc) • 1.21 kB
JavaScript
import path from 'path';
import webpack from 'webpack';
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
import { fileURLToPath } from 'url';
import { dirname } from 'path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
export default {
entry: './src/browser.ts',
mode: 'production',
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
fallback: {
crypto: 'crypto-browserify',
stream: 'stream-browserify',
buffer: 'buffer/',
process: 'process/browser',
},
},
output: {
filename: 'nostr-nsec-seedphrase.min.js',
path: path.resolve(__dirname, 'dist/browser'),
library: {
name: 'NostrNsecSeedphrase',
type: 'umd',
umdNamedDefine: true,
},
globalObject: 'this',
},
plugins: [
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
process: 'process/browser',
}),
new BundleAnalyzerPlugin({
analyzerMode: 'static',
openAnalyzer: false,
}),
],
optimization: {
minimize: true,
},
};