1.0.2 • Published 10 years ago
browserify-loader2 v1.0.2
browserify-loader
A CommonJS Loader for browserify workflow.
What is browserify-loader
browserify-loader is another CommonJS loader for browserify workflow. With BL, You don’t need any tools like watchify, browserify-middleware to auto build and serve bundle *js in development env.
browserify-loader is similar with requirejs, but:
- Follow module loading algorithm
- get rid of wrapper code like
define() - be compatible all
npmpackage and allbowercomponents witch supportCommonJS. likeunderscore,backbone,jQueryand so on.
Getting started
Install
Download browserify-loader with npm:
$ npm install browserify-loader2Put browserify-loader.min.js in your page:
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<script main="./app.js" src="node_modules/browserify-loader2/out/browserify-loader.min.js"></script>
</body>
</html>Then, browserify-loader will start to run for main file in your package.json file.
Options
- main: the main entrance script like
app.jsinnode app.js - defineName: The name of the define function. Not supported yet.
- forceExt: Force loading files with valid extensions only, ignore files with invalid extenstion. Not supported yet.
- forceDir: Force path which ends with
/to be a directory module. Not supported yet.
Example
Look into example/index.html.
Tests
The module loader has test cases written in Qunit, open test/index.html.