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

@ministryofjustice/module-alias

Package Overview
Dependencies
Maintainers
12
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ministryofjustice/module-alias

Module aliases (based on work by Nick Gavrilov artnikpro@gmail.com)

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.9K
increased by13707.14%
Maintainers
12
Weekly downloads
 
Created
Source

@ministryofjustice/module-alias

Map package aliases and directories to their location of the file system, with configuration in package.json.

Not:

require('../../../../some/very/deep/module')

But:

const module = require('@deep/module')

Or you can register directories that will behave like node_modules.

Install

npm i @ministryofjustice/module-alias

Usage

Add configuration to package.json:

Aliases

{
  "_moduleAliases": {
    "@root"      : ".",
    "@deep"      : "src/some/very/deep/directory/or/file",
    "@my_module" : "lib/some-file.js",
    "something"  : "src/foo"
  }
}

Directories

{
  "_moduleDirectories": [
    "src/node_modules_custom"
  ]
}

Then include this line at the top of your module:

require('@ministryofjustice/module-alias/register')

@ministryofjustice/module-alias will resolve the location of package.json and register any aliases contained in it before applying the alias to any require calls made by your module.

About this package

@ministryofjustice/module-alias is a fork of module-alias with an improved mechanism for resolving the location of package.json and the removal of some features we do not use (such as custom handlers).

Keywords

FAQs

Package last updated on 25 Nov 2019

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