Skip to content

"module" entry points to web bundle #45

Closed
@KrysKruk

Description

@KrysKruk

What happened?

I'm bundling my node.js code with webpack for serverless.
With bundled @octokit/webhooks-methods, my code doesn't run and throws an error: Exception: ReferenceError: crypto is not defined.

What did you expect to happen?

Code generated by webpack to run.

What the problem might be

@octokit/webhooks-methods defines these entries in package.json:

  "main": "dist-node/index.js",
  "module": "dist-web/index.js",
  "source": "dist-src/index.js",
  "types": "dist-types/index.d.ts",

Webpack favours module (see webpack/webpack#5756 ) because it helps with e.g. better tree shaking, but the module entry here points to the dist-web/index.js file which doesn't include crypto and buffer imports.

IMO the module entry should be renamed to browser.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: BlockedSome technical or requirement is blocking the issueType: BugSomething isn't working as documented

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions