sudo-suhas/elastic-builder

Remove dependency on Node.js specific modules

lostpebble opened this issue · 1 comments

Hi,

I'd like to use this module inside a non-Node.js context, and unfortunately the dependency on "util" is not allowing me to:

X [ERROR] Could not resolve "util"

    ../node_modules/elastic-builder/lib/core/util.js:9:23:
      9 │ var _require = require('util'),
        │                        ~~~~~~
        ╵                        "./util"

  The package "util" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "--platform=node" to do that, which will remove this error.    

X [ERROR] Could not resolve "util"

    ../node_modules/elastic-builder/lib/queries/helper.js:3:23:
      3 │ var _require = require('util'),

Specifically, I'd like to use this from Cloudflare Workers- which is basically the same context as a Service Worker. Since this project is about simply creating JSON to put into a POST request to an endpoint- it seems like using Node.js specific modules should not be necessary for any core functionality, and I guess they were used for some specific utility functionality which could be patched, either directly or with another module which doesn't rely on any specific execution context.

If I look into it, and create a PR with the compatible changes- would this be alright?

Yes, would be happy to accept the PR.