relative-require
v0.2.0
Published
Refactor requires to be relative
Downloads
3
Readme
Relative Require
Refactor absolute require paths to relative paths
./components/login/LoginForm.js
var Auth = require('modules/auth');
// ...
Run The Script
var path = require('path');
var base = path.join(__dirname, './app')
toRelative({
base: base,
exclude: [
'nuclear-js',
'lodash',
'es6-promise',
'immutable',
'jquery',
'sprintf',
],
// dont actually write
dry: true,
});
Becomes
var Auth = require('../../modules/auth');
// ...
Options
base
(required) module resolve rootexclude
(optional) array of modules to not rewritedry
(optional) dont write files