Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

create-require

nuxt-contrib66.6mMIT1.1.1TypeScript support: included

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

readme

create-require

npm version npm downloads Github Actions Codecov

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

Install

yarn add create-require

npm install create-require

Usage

function createRequire (filename: string | URL): NodeRequire;
const createRequire = require('create-require')

const myRequire = createRequire('path/to/test.js')
const myModule = myRequire('./test-sibling-module')

License

MIT

changelog

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

1.1.1 (2020-11-26)

Bug Fixes

  • types: explicitly import the URL type (#3) (66a98cc)

1.1.0 (2020-11-21)

Features

  • fallback to process.cwd() if no filename provided either (ae5e0d6)

1.0.2 (2020-06-12)

Bug Fixes

  • use fake path if filename is directory (c8e0983)

1.0.1 (2020-06-06)

Bug Fixes

  • types: specify types field (2c06464)

0.0.1 (2020-05-04)