Open sraka1 opened 4 years ago
Node v13.8.0
Module.createRequireFromPath() is deprecated since Node v12.2.0. An error is thrown when it is used on v13.
Use haul in a project with Node version > 13.
In https://github.com/callstack/haul/blob/d64efa45b30cd92026c9b5a595ed838db038b077/packages/haul-core/src/utils/importModule.ts#L88 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.
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 https://github.com/callstack/haul/blob/d64efa45b30cd92026c9b5a595ed838db038b077/packages/haul-core/src/utils/importModule.ts#L88 something like the following could be implemented (to main compatibility with Node 10-12)
The method seems to be identical in function, only its naming has changed.