Babel@6/7 doesn't export default module.exports any more - T2212 Kill CommonJS default export behavior
It means in a ES6 module, you have to use require
like:
const A = require('a').default;
transform:
const A = require('a');
into
function __require_default_func__(module) { return module && module.__esModule ? module["default"] : module; }
const A = __require_default_func__(require('a'));
string/regexp/function/array
, exclude module
{
plugins: [
['transform-require-default', {
exclude: "lodash",
exclude: /lodash/,
exclude: [
/lodash/,
"react"
],
exclude(module) {
return module === 'lodash';
}
}]
]
}