Skip to content

Remove dependency on Node.js specific modules #160

@lostpebble

Description

@lostpebble

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions