mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-09 08:38:50 +00:00
build esm module that can be imported from browsers.
closes https://github.com/fiatjaf/nostr-tools/issues/14
This commit is contained in:
25
build.js
Executable file
25
build.js
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const esbuild = require('esbuild')
|
||||
const alias = require('esbuild-plugin-alias')
|
||||
const nodeGlobals = require('@esbuild-plugins/node-globals-polyfill').default
|
||||
|
||||
const buildOptions = {
|
||||
entryPoints: ['index.js'],
|
||||
outfile: 'nostr.js',
|
||||
bundle: true,
|
||||
format: 'esm',
|
||||
plugins: [
|
||||
alias({
|
||||
stream: require.resolve('readable-stream')
|
||||
}),
|
||||
nodeGlobals({buffer: true})
|
||||
],
|
||||
define: {
|
||||
window: 'self',
|
||||
global: 'self'
|
||||
},
|
||||
loader: {'.js': 'jsx'}
|
||||
}
|
||||
|
||||
esbuild.build(buildOptions).then(() => console.log('build success.'))
|
||||
Reference in New Issue
Block a user