Skip to content

tetsuo/rewritify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

rewritify

browserify transform that rewrites require paths.

example

browserify(__dirname + '/index.js')
  .transform(rewritify, {
    mapping: {
      'bar': './bar/lib'relative to basedir
    },
    basedir: __dirname + '/foo',
    extensions: ['coffee', 'js']
  });

Now you can do require('bar/x') from anywhere.

api

## rewritify([file,] opts)

opts object can have these properties:

  • mapping lets you map a name into a lookup path. You can also use this per-module or per-file basis like browser field.
  • basedir is used to resolve relative paths defined in mapping property, by default this is dirname of the processed file.
  • extensions is an array of optional extra extensions for module lookup machinery to use when the extension has not been specified.

license

mit

About

browserify transform that rewrites require paths

Resources

Stars

Watchers

Forks

Packages

No packages published