Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

create-require

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-require

Polyfill for Node.js module.createRequire (<= v12.2.0)

  • 1.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
21M
increased by2.13%
Maintainers
1
Weekly downloads
 
Created

What is create-require?

The create-require npm package is designed to dynamically create a `require` function at a given path. This is particularly useful in scenarios where you need to resolve modules or require files relative to a specific directory, rather than the current working directory of the process. It can be used to simulate the behavior of Node.js's `require` in different contexts or to dynamically load modules from various locations in a filesystem.

What are create-require's main functionalities?

Creating a custom require function for a specific directory

This feature allows you to create a new `require` function that resolves modules as if it was called from the specified directory. This is useful for loading modules from a directory different from the current script's directory.

const createRequire = require('create-require');
const myRequire = createRequire('/path/to/my/directory');
const myModule = myRequire('./myModule');

Other packages similar to create-require

FAQs

Package last updated on 26 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc