ancashoria / graphql-kafka-subscriptions

Apollo graphql subscriptions over Kafka protocol
MIT License
187 stars 55 forks source link

Webpack Incompatible #11

Open mplaxton opened 5 years ago

mplaxton commented 5 years ago

Hi,

I've found that if I use the graphql-kafka-subscriptions module (0.2.3) with webpack then I get the following error when the module is required:

path.js:28
    throw new TypeError('Path must be a string. Received ' + inspect(path));
    ^

TypeError: Path must be a string. Received undefined
    at assertPath (path.js:28:11)
    at dirname (path.js:1349:5)
    at Function.getRoot (webpack:///./node_modules/bindings/bindings.js?:151:13)
    at bindings (webpack:///./node_modules/bindings/bindings.js?:60:32)
    at eval (webpack:///./node_modules/node-rdkafka/librdkafka.js?:10:87)
    at Object../node_modules/node-rdkafka/librdkafka.js (/home/vagrant/Git/money-management/subscription-server/dist/app.js:468:1)
    at __webpack_require__ (/home/vagrant/Git/money-management/subscription-server/dist/app.js:20:30)
    at eval (webpack:///./node_modules/node-rdkafka/lib/client.js?:14:13)
    at Object../node_modules/node-rdkafka/lib/client.js (/home/vagrant/Git/money-management/subscription-server/dist/app.js:355:1)
    at __webpack_require__ (/home/vagrant/Git/money-management/subscription-server/dist/app.js:20:30)

This is simple to reproduce by requiring the module in the webpack startup target, e.g

const { KafkaPubSub } = require('graphql-kafka-subscriptions');

It would be great if the module was compatible with webpack.

Kind regards, Matt

cramhead commented 3 years ago

Seems to work with webpack now. I'm using 0.4.0 with webpack: 4.43.0