1.1.4 • Published 2 years ago
ns-require v1.1.4
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`