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

node-requirejs

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-requirejs

Lets you use you requirejs configuration in Node

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
472
decreased by-36.3%
Maintainers
1
Weekly downloads
 
Created
Source

node-requirejs

Lets you use requirejs modules in Node

node-requirejs comes in hand when you have a requirejs based application and want to load your AMD defined modules in a Node environment. One possible use case for this is to unit test without any browser in the Node environment (with mocha, for example)

Getting started

npm install node-requirejs

Usage

You can instantiate and provide a configuration at the same time

var requirejs = require('requirejs').requirejs(yourRequireJSConfig);
var someModule = requirejs('some-module');

Or you can add an extra config on top of your 'normal' one

var requirejs = require('requirejs').requirejs(yourRequireJSConfig, someExtraConfig);
var someModule = requirejs('some-module');

N.B. The component has a default configuration (that you can of course override):

{
   baseUrl: '',
   nodeRequire: 'require'
}

Configuration

The module expose a config method that can be used to apply incremental configurations that will be painlessly merged into the existing configuration

E.g.

var requirejs = require('requirejs').requirejs(yourRequireJSConfig);
requirejs.config({ "baseUrl": "modules/level1" });
requirejs.config({ "paths": { "some-module": "level2/some-module" } });
var someModule = requirejs('some-module');

Test

npm test

License

MIT

Keywords

FAQs

Package last updated on 20 Mar 2015

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