cypress-browserify-preprocessor icon indicating copy to clipboard operation
cypress-browserify-preprocessor copied to clipboard

How to better add individual babel plugins?

Open bahmutov opened this issue 6 years ago • 1 comments

I am trying to transpile spec that has

it('transpiles Object.fromEntries', () => {
  // https://github.com/tc39/proposal-object-from-entries
  const obj = Object.fromEntries([['a', 0], ['b', 1]])
})

I am trying to modify babel preset-env options via preprocessor to add useBuiltIns https://babeljs.io/docs/en/next/babel-preset-env#usebuiltins but nothing seems to work. I think a few more examples of adding support for specific babel transforms would be nice.

In general, I think a good question to answer in our docs would be:

Should users push Babel plugins into default options? Or should they add them to .babelrc file and enable babelrc options?

bahmutov avatar Feb 17 '19 14:02 bahmutov

Babel 7.0 itself uses babel.config.js to configure plugins. @cypress/browserify-preprocessor doesn't obey babel.config.js, but I think it should. Other similar adapters like babel-jest do this.

jamesarosen avatar Mar 14 '19 00:03 jamesarosen