Skip to content

Brightspace/frau-module-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

frau-module-loader

NPM version Build status Dependency Status

A utility to allow free-range app developers to define external browserify dependencies without having to set up browserify-shim.

Usage

var loader = require('frau-module-loader');

module.exports = function(parent, options) {
	var config = {
		paths: {
			'superagent': 'https://s.brightspace.com/lib/superagent/1.2.0/superagent.min'
		}
	};

	loader(['superagent'], config, function() {
		// Your app code here...
	});
};

loader takes three parameters:

  • deps: The list of dependencies for your app
  • config: The requirejs config that specifies shims, paths, etc. for dependencies
  • callback: The callback to start your app once requirejs has finished setup

The library also exposes the global define function so it can be used to define your own modules:

var loader = require('frau-module-loader');

loader.define('react-router-shim', ['react'], function(React) {
	window.React = React;
});

Contributing

Contributions are welcome, please submit a pull request!

Code Style

This repository is configured with EditorConfig rules and contributions should make use of them.