ns-require

Require with Namespace

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
ns-require
301.1.49 months agoa year agoMinified + gzip package size for ns-require in KB

Readme

ns-require
Codecov downloads npm GitHub
Require with Namespace.

Basic Usage

import ns from 'ns-require'

const scope = ns({
  namespace: 'awesome',
  prefix: 'plugin',
})

scope.require('foo')        // will resolve to `awesome-plugin-foo`
scope.require('@foo/bar')   // will resolve to `@foo/awesome-plugin-bar`

With Official Scope

import ns from 'ns-require'

const scope = ns({
  namespace: 'awesome',
  prefix: 'plugin',
  official: 'scope',
})

scope.require('foo')        // will resolve to `@scope/plugin-foo`
                            // and then `awesome-plugin-foo`
scope.require('@foo/bar')   // will resolve to `@foo/awesome-plugin-bar`