RocketChat / meteor-streamer

2 way communication over DDP with better performance.
MIT License
82 stars 27 forks source link

Remove underscore/lodash dependency? #40

Open vbgm opened 5 years ago

vbgm commented 5 years ago

There seem to be single underscore dependency here: https://github.com/RocketChat/meteor-streamer/blob/master/packages/rocketchat-streamer/server/server.js#L16 and since I do not have underscore installed, the versions since 1.* do not work.

fgm commented 5 years ago

This causes errors for us too, and seems to be a consequence of the underscore packaging removal in Meteor 1.7 ( https://github.com/meteor/meteor/pull/9596 ) . Partial stack trace:

1|foo | Exception in added observe/observeChanges callback: ReferenceError: _ is not defined 1|foo | at changedPayload (packages/rocketchat:streamer/server/server.js:16:2) 1|foo | at Streamer._emit (packages/rocketchat:streamer/server/server.js:386:15) 1|foo | at Streamer.emit (packages/rocketchat:streamer/server/server.js:407:8) (caller does an emit()).

In our case, the interim fix is to add 1 line to the main server-side file:

global._ = require('meteor/underscore')._;

This makes underscore available as a global again, and fixes the issue until a proper fix is applied, either by adding the dependency or, probably better, either interning the check or importing lodash.isEmpty https://www.npmjs.com/package/lodash.isempty as a smaller replacement since the rest of underscore is not used.

mikkelking commented 4 years ago

I am happy to pick this up and do a PR, but I am not sure if this is the right repo... atmosphere says 1.1.0 is released, but the package.js file says we are at 1.0.2. ?

edemaine commented 4 years ago

@mikkelking Maybe you were looking at an old tree? It looks like the version number was updated in https://github.com/RocketChat/meteor-streamer/commit/00a4e6be4973ab0c848c123af05ebab9bd3b0005 back in December.

I also just ran into this error and could do a PR if @mikkelking is no longer able.