From 882c6cec26b1776f283880e103fad0bb1ed84803 Mon Sep 17 00:00:00 2001 From: nolimitdev Date: Thu, 26 Jul 2018 18:19:47 +0200 Subject: [PATCH] Add support for babel options via browserify cli Add support for setting for example babel presets using browserify cli: browserify -t [ vueify --babel [ --presets [ env ] ] ] -e main.js -o build.js --- lib/compilers/babel.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/compilers/babel.js b/lib/compilers/babel.js index be317b4..ef3a17e 100644 --- a/lib/compilers/babel.js +++ b/lib/compilers/babel.js @@ -40,6 +40,18 @@ module.exports = function (raw, cb, compiler, filePath) { try { var babel = require('babel-core') + + // browserify cli options + var opts = compiler.options.babel + if (opts) { + delete opts._ + // "--opt [ a b ]" and "--opt a --opt b" are allowed: + if (opts.ignore && opts.ignore._) opts.ignore = opts.ignore._ + if (opts.only && opts.only._) opts.only = opts.only._ + if (opts.plugins && opts.plugins._) opts.plugins = opts.plugins._ + if (opts.presets && opts.presets._) opts.presets = opts.presets._ + } + var options = assign({ comments: false, filename: filePath,