Just created my first npm package.
try to run it with RunKit and my package gets into a part of the code which throws an error.
I indeed had this issue (due to bad packaging) but fixed it. When I try the sample on my desktop it works (no exception is thrown, data printed on console).
Here is what I’m trying to run:
const {GDCCallbackDataReceiver} = require('@gdc-js/common');
const {GDCLogNotificationHandler} = require('@gdc-js/common');
const httpCollector = new GDCCollectorHttp({
properties: {},
dataReceiver: new GDCCallbackDataReceiver((data, meta) => {
console.log(data);
console.log(meta);
}),
notificationHandler: new GDCLogNotificationHandler(),
});
httpCollector.collect(['http://www.iiiiiiii.com/index.html']);
Hi there, I’m seeing the error GDCCollectorHttp is not defined, which makes sense because GDCCollectorHttp is not in scope in this program.
I’m not sure where in your package GDCCollectorHttp is defined, but you will need to expose it. Likewise, I’m not sure how this could work locally in it’s current state.
It seems that I had the first line in the code missing.
I can’t seem to find how to edit my original post, so here is the correct code (and it’s working when run not in RunKit):