threepointone/glamor

babel 7 support

jaredh159 opened this issue · 0 comments

As noted here: #386 babel 7 requires that plugins export a function, not an object. Babel 7 looks like it's ready to land very shortly.

Without the modification or the workaround below, you get this error:

Plugin/Preset files are not allowed to export objects, only functions. In ${filepath}

Until something gets merged, a workaround is to inline a function in babel.config.js like this:

const glamor = require('glamor/babel');

module.exports = {
  presets: [
    '@babel/preset-env',
  ],
  plugins: [
    () => glamor, // <-- satisfy babel 7's requirement of plugins being function
  ],
};