diff --git a/lib/parse.js b/lib/parse.js index be23413e..8a8e86b7 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -114,7 +114,7 @@ module.exports = warner(class Parser extends EE { this[SAW_NULL_BLOCK] = false this[SAW_EOF] = false - this.on('end', () => setTimeout(() => this.emit('close'))) + this.on('end', () => queueMicrotask(() => this.emit('close'))) if (typeof opt.onwarn === 'function') { this.on('warn', opt.onwarn)