Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/zoubin/realpathify

plugin for browserify to resolve symlinks to realpaths, to make transforms work for symlinked local modules
https://github.com/zoubin/realpathify

Last synced: 8 days ago
JSON representation

plugin for browserify to resolve symlinks to realpaths, to make transforms work for symlinked local modules

Awesome Lists containing this project

README

        

# realpathify
**Deprecated**

Browserify has fixed the problem in this [commit](https://github.com/substack/node-browserify/commit/504832b4b9fde30c36877122b265ddccbea7be77).

plugin for browserify to resolve symlinks to their realpaths, to make transforms work for symlinked local modules

substack has recommended a nice way of organizing your local modules in [browserify-handbook](https://github.com/substack/browserify-handbook#symlink).

However, transforms applied in browserify won't work on modules whose [resolve](https://www.npmjs.com/package/resolve)d paths containing `node_modules` by default. So, if you symlink your local modules in `node_modules`, you probably have to figure out some way to make transforms applied to them.

This module presents a way to do that, by hacking `b._bresolve`, to make it resolve symlinked subdirectories in `node_modules` to their real paths, so `module-deps` won't treat them as global modules, and apply transforms to them.

## Usage

```javascript
var b = browserify(bOpts);
var realpathify = require('realpathify');
b.plugin(realpathify, { filter: ['local_module'] });

```

## b.plugin(realpathify, opts)

### opts

#### filter

Type: `String`, `Array`

`Optional`

If you specified the `filter` option, then only subdirectories contained in it will be realpathified. It makes `realpathify` work more fast.

If not specified, `realpathify` will try to resolve all subdirectories in `node_modules`.

## realpathify.async(asyncResolve, filter)

Return a realpathified async resolve function.

## realpathify.sync(syncResolve, filter)

Return a realpathified sync resolve function.

## realpathify.realpath(file, filter, cache)

Resolve `file` to realpath.