babel / babel-brunch

Brunch plugin for Babel
ISC License
69 stars 38 forks source link

Allow plugins/presets with explicit name #42

Closed ghost closed 7 years ago

ghost commented 7 years ago

Some of the plugins don't follow the babel-plugin-${name} convention, which as result cannot be included, because babel-brunch is always adding the bable-plugin- prefix to the name here: https://github.com/babel/babel-brunch/blob/master/index.js#L36

We should somehow let the consumer specify, if the name should be used as is, or not. My idea is to use a simple ! at the end of the plugin / preset -name

for example

plugins: {
    babel: {
      ignore: [/web\/static\/vendor/],
      presets: ['es2015', 'es2016', 'react'],
      plugins: [
         "transform-object-rest-spread", // this will resolve babel-plugin-transform-object-rest-spread
         "babel-root-import!", {                 // this will resolve babel-root-import because of `!` at the end
             "rootPathSuffix": "src/js"
         }]
    }