From 18619fcc6da5fa5f4bb113caa14b62185656ff54 Mon Sep 17 00:00:00 2001 From: Kazato Sugimoto Date: Sat, 7 Nov 2015 12:12:50 +0900 Subject: [PATCH] Use local babel in babel-plugin-espower Fix the issue that babel-plugin-espower resolves a different Babel version --- lib/babel.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/babel.js b/lib/babel.js index a6ca59100..84af5b977 100644 --- a/lib/babel.js +++ b/lib/babel.js @@ -5,16 +5,6 @@ var requireFromString = require('require-from-string'); var hasGenerators = parseInt(process.version.slice(1), 10) > 0; var path = process.argv[2]; -var options = { - blacklist: hasGenerators ? ['regenerator'] : [], - optional: hasGenerators ? ['asyncToGenerator', 'runtime'] : ['runtime'], - plugins: [ - createEspowerPlugin(require('babel-core'), { - patterns: require('./enhance-assert').PATTERNS - }) - ] -}; - var babel; try { @@ -24,5 +14,15 @@ try { babel = require('babel-core'); } +var options = { + blacklist: hasGenerators ? ['regenerator'] : [], + optional: hasGenerators ? ['asyncToGenerator', 'runtime'] : ['runtime'], + plugins: [ + createEspowerPlugin(babel, { + patterns: require('./enhance-assert').PATTERNS + }) + ] +}; + var transpiled = babel.transformFileSync(path, options); requireFromString(transpiled.code, path);