frau-module-loader

0.1.2 • Public • Published

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.

Readme

Keywords

Package Sidebar

Install

npm i frau-module-loader

Weekly Downloads

0

Version

0.1.2

License

Apache-2.0

Last publish

Collaborators

  • d2l-travis-deploy