rubensworks / rdf-dereference.js

Dereference any URL for its RDF contents
MIT License
33 stars 4 forks source link

Polyfill the `process` #42

Closed jeswr closed 1 year ago

jeswr commented 1 year ago

As of https://github.com/comunica/comunica/commit/cbf47cc0e38294d0fadb244fb9fab7e922db941c Comunica polyfills the process for query engines. However, rdf-dereference does not perform this polyfill which results in "process not defined" errors when trying to rdf-dereference with the default webpack config for Angular.

As far as I see it there are 2 ways of going about a solution:

  1. Add a process polyfill here; and also in other libraries that will be affected such as rdf-parse, rdf-serialize etc.
  2. Add the polyfill to every comunica actor that references the process or uses the readable-stream library.
rubensworks commented 1 year ago

I'm wondering if this hack is even still needed at this stage. readable-stream recently removed their references to global process.

But in any case, if it would still be necessary, I prefer option 2. Perhaps we can just add it to @comunica/core then.

jeswr commented 1 year ago

I'm wondering if this hack is even still needed at this stage. readable-stream recently removed their references to global process.

I was encountering this issue on v2.6.10 of Comunica when creating a fresh Angular app last week. Though thinking about it the problem may be coming Comunica referencing the process globally here and rdf-dereference using it here rather than in the readable-stream package.

Perhaps we fix those references first and then see if polyfilling is still necessary. I'm assuming the desired fixes in those cases is just to add the same as https://github.com/nodejs/readable-stream/blob/232e71154dbdc34f6a97a0449f902455ec495373/lib/internal/streams/destroy.js#L5 to the file

rubensworks commented 1 year ago

Perhaps we fix those references first and then see if polyfilling is still necessary. I'm assuming the desired fixes in those cases is just to add the same as https://github.com/nodejs/readable-stream/blob/232e71154dbdc34f6a97a0449f902455ec495373/lib/internal/streams/destroy.js#L5 to the file

Sounds perfect!

rubensworks commented 1 year ago

Done in https://github.com/rubensworks/rdf-dereference.js/commit/2accbad301bfad2e07bd424dbd88baef319115f0