babel-plugin-module-alias
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -11,7 +11,8 @@ 'use strict'; | ||
var result = {}; | ||
if (!Array.isArray(state.opts)) { | ||
state.opts = [state.opts]; | ||
var opts = state.opts; | ||
if (!Array.isArray(opts)) { | ||
opts = [opts]; | ||
} | ||
state.opts.forEach(function (moduleMapData) { | ||
opts.forEach(function (moduleMapData) { | ||
result[moduleMapData.expose] = moduleMapData.src; | ||
@@ -23,2 +24,8 @@ }); | ||
function resolve(filename) { | ||
if (path.isAbsolute(filename)) return filename; | ||
if (process.env.PWD) return path.resolve(process.env.PWD, filename); | ||
return path.resolve(filename); | ||
} | ||
function mapToRelative(currentFile, module) { | ||
@@ -28,4 +35,4 @@ var from = path.dirname(currentFile); | ||
from = path.isAbsolute(from) ? from : path.resolve(process.env.PWD, from); | ||
to = path.isAbsolute(to) ? to : path.resolve(process.env.PWD, to); | ||
from = resolve(from); | ||
to = resolve(to); | ||
@@ -32,0 +39,0 @@ var moduleMapped = path.relative(from, to); |
{ | ||
"name": "babel-plugin-module-alias", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"main": "lib/index.js", | ||
@@ -24,8 +24,8 @@ "description": "Babel plugin to rewrite the path in require() and ES6 import", | ||
"devDependencies": { | ||
"babel-cli": "^6.1.4", | ||
"babel-core": "^6.1.4", | ||
"babel-preset-es2015": "^6.1.4", | ||
"eslint": "^1.7.3", | ||
"eslint-config-airbnb": "^2.0.0", | ||
"mocha": "^2.3.3" | ||
"babel-cli": "^6.4.0", | ||
"babel-core": "^6.4.0", | ||
"babel-preset-es2015": "^6.3.13", | ||
"eslint": "^1.10.3", | ||
"eslint-config-airbnb": "^3.1.0", | ||
"mocha": "^2.3.4" | ||
}, | ||
@@ -32,0 +32,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
6710
76