babel-plugin-module-rewrite
Advanced tools
Comparing version 0.1.2 to 0.2.0
@@ -66,3 +66,3 @@ 'use strict'; | ||
function transformImportCall(nodePath, state) { | ||
function transformImportExportCall(nodePath, state) { | ||
var moduleArg = nodePath.node.source; | ||
@@ -72,3 +72,3 @@ if (moduleArg && moduleArg.type === 'StringLiteral') { | ||
if (modulePath) { | ||
nodePath.replaceWith(t.importDeclaration(nodePath.node.specifiers, t.stringLiteral(modulePath))); | ||
nodePath.node.source = t.stringLiteral(modulePath); | ||
} | ||
@@ -87,4 +87,9 @@ } | ||
exit: function exit(nodePath, state) { | ||
return transformImportCall(nodePath, state); | ||
return transformImportExportCall(nodePath, state); | ||
} | ||
}, | ||
ExportDeclaration: { | ||
exit: function exit(nodePath, state) { | ||
return transformImportExportCall(nodePath, state); | ||
} | ||
} | ||
@@ -91,0 +96,0 @@ } |
{ | ||
"name": "babel-plugin-module-rewrite", | ||
"version": "0.1.2", | ||
"version": "0.2.0", | ||
"main": "lib/index.js", | ||
@@ -5,0 +5,0 @@ "description": "Babel plugin to dynamically rewrite the path in require() and ES6 import", |
@@ -35,3 +35,3 @@ # babel-plugin-module-rewrite | ||
} else { | ||
return originalPath. replace('~', 'common'); | ||
return originalPath.replace('~', 'common'); | ||
} | ||
@@ -38,0 +38,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7087
80