default-require-extensions

3.0.1 • Public • Published

default-require-extensions

Node's default require extensions as a separate module

Handy for require extension authors that want reliable access to the default extension implementations.

By the time your extension is loaded, the default extension may have already been replaced. This provides extensions functionally identical to the default ones, which you know you can access reliably, no matter what extensions have been installed previously.

This package is not compatible with ESM.

Install

npm install default-require-extensions

Usage

const js = require('default-require-extensions/js');
const json = require('default-require-extensions/json');

require.extensions['.js'] = js;
require.extensions['.js'] = json;

Note: You would never actually do the above. Use these in your custom require extensions instead.

Package Sidebar

Install

npm i default-require-extensions

Weekly Downloads

3,815,548

Version

3.0.1

License

MIT

Unpacked Size

3.34 kB

Total Files

5

Last publish

Collaborators

  • sindresorhus
  • novemberborn