ns-require
v1.1.4
Published
Require with Namespace
Downloads
14,833
Readme
ns-require
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`