fix browser tests

This commit is contained in:
Sebastian McKenzie
2015-04-30 20:11:32 +01:00
parent 92e7a01d14
commit c12e8122f8
6 changed files with 18 additions and 14 deletions

View File

@@ -31,7 +31,7 @@ export default class PluginManager {
// this is a plugin in the form of "foobar" or "foobar:after"
// where the optional colon is the delimiter for plugin position in the transformer stack
var match = key.match(/^(.*?):(after|before)$/);
var match = name.match(/^(.*?):(after|before)$/);
if (match) [, name, position] = match;
var loc = util.resolveRelative(name) || util.resolveRelative(`babel-plugin-${name}`);

View File

@@ -43,6 +43,9 @@ export function resolve(loc: string) {
var relativeMod;
export function resolveRelative(loc: string) {
// we're in the browser, probably
if (typeof Module === "object") return null;
if (!relativeMod) {
relativeMod = new Module;
relativeMod.paths = Module._nodeModulePaths(process.cwd());