From 3564309a773328df2cb408429c4fddcfac9aea1b Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Mon, 20 Apr 2015 00:05:06 +0100 Subject: [PATCH] allow plugins to be specified as an object with transformer and position - fixes #1300 --- src/babel/transformation/file/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/babel/transformation/file/index.js b/src/babel/transformation/file/index.js index c053910ad8..41250e8773 100644 --- a/src/babel/transformation/file/index.js +++ b/src/babel/transformation/file/index.js @@ -241,7 +241,10 @@ export default class File { var plugin; if (name) { - if (typeof name === "string") { + if (typeof name === "object" && name.transformer) { + plugin = name.transformer; + position ||= name.position; + } else if (typeof name === "string") { // 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