This experimental syntax requires enabling the parser plugin: 'exportDefaultFrom'
I am getting the above error while trying to move the entire application from react v15.6to v16.2, by using the migration tool from facebook like jscodeshift.
Add @babel/plugin-proposal-export-default-from (https://git.io/vb4yH) to the 'plugins' section of your Babel config to enable transformation.
I solved this problem.
const parser = require('./src/parser');
const jscodeshift = require('jscodeshift').withParser(parser);
./src/parser:
'use strict';
const babylon = require('babylon');
// These are the options that were the default of the Babel5 parse function
// see https://github.com/babel/babel/blob/5.x/packages/babel/src/api/node.js#L81
const options = {
  sourceType: 'module',
  allowHashBang: true,
  ecmaVersion: Infinity,
  allowImportExportEverywhere: true,
  allowReturnOutsideFunction: true,
  plugins: [
    'estree',
    'jsx',
    'asyncGenerators',
    'classProperties',
    'doExpressions',
    'exportExtensions',
    'functionBind',
    'functionSent',
    'objectRestSpread',
    'dynamicImport',
    'nullishCoalescingOperator',
    'optionalChaining',
    'exportDefaultFrom'
  ],
};
/**
 * Wrapper to set default options
 */
exports.parse = function parse (code) {
  return babylon.parse(code, options);
};
Please add the 'exportDefaultFrom' into plugins.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With