fix: use createRequire for ESM, fixes #334

This commit is contained in:
Harttle
2022-04-18 00:43:17 +08:00
parent c7216c6358
commit eec381ec72
13 changed files with 89 additions and 4 deletions
+2 -2
View File
@@ -1,10 +1,10 @@
import { stringify } from '../util/underscore'
import { Emitter } from './emitter'
import { PassThrough } from 'stream'
export class StreamedEmitter implements Emitter {
public buffer = '';
// eslint-disable-next-line @typescript-eslint/no-var-requires
public stream: NodeJS.ReadWriteStream = new (require('stream').PassThrough)()
public stream: NodeJS.ReadWriteStream = new PassThrough()
public write (html: any) {
this.stream.write(stringify(html))
}