Converted pubsub to CommonJS