@spanexx/event-bus-cjs
v0.0.1
Published
CommonJS build of @spanexx/event-bus — for CJS consumers (nest, most node apps). Source is mirrored from @spanexx/event-bus; updated in lockstep.
Maintainers
Readme
@spanexx/event-bus-cjs
CommonJS build of @spanexx/event-bus for CJS consumers.
Why this exists
@spanexx/event-bus is an ESM-only package ("type": "module"). CJS consumers — most Node apps, NestJS, TypeScript compiled to commonjs — cannot require() it.
This package ships the same source, compiled to CJS. The source is mirrored from @spanexx/event-bus/src/ at build time and updated in lockstep.
Install
npm install @spanexx/event-bus-cjsUsage
// CJS — works in NestJS, Express, plain Node, etc.
const { createEventBus } = require('@spanexx/event-bus-cjs');
const bus = createEventBus();
bus.subscribe('hello.world', (e) => console.log('got', e));
bus.publishInternalEvent(bus, 'hello.world', { foo: 'bar' });For ESM consumers (Angular, Vite, modern bundlers), use the original @spanexx/event-bus instead.
License
MIT
