Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module.createRequireFromPath() is deprecated. #746

Open
sraka1 opened this issue Jun 26, 2020 · 0 comments
Open

Module.createRequireFromPath() is deprecated. #746

sraka1 opened this issue Jun 26, 2020 · 0 comments

Comments

@sraka1
Copy link

sraka1 commented Jun 26, 2020

Environment

Node v13.8.0

Description

Module.createRequireFromPath() is deprecated since Node v12.2.0. An error is thrown when it is used on v13.

Reproducible Demo

Use haul in a project with Node version > 13.

Proposed fix

In

// Create resolver for this module.
something like the following could be implemented (to main compatibility with Node 10-12)

  const createRequireWrapper = Module.createRequire || Module.createRequireFromPath
  // Create resolver for this module.
  const currentResolve = ((createRequireWrapper(
    module.filename
  ) as unknown) as {
    resolve: RequireResolve;
  }).resolve;

The method seems to be identical in function, only its naming has changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants