fix browser tests
This commit is contained in:
@@ -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}`);
|
||||
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user