admin管理员组文章数量:1327849
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.6
to v16.2
, by using the migration tool from facebook like jscodeshift
.
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.6
to v16.2
, by using the migration tool from facebook like jscodeshift
.
- It is a known issue github./facebook/jscodeshift/issues/252 – Dipen Shah Commented Aug 17, 2018 at 4:46
- 3 amazing what you can find by simply using a search engine on the exact title of the question! – Jaromanda X Commented Aug 17, 2018 at 5:01
- Possible duplicate of Babel's TypeScript parsing is not consistent – Praveen Kumar Commented Aug 20, 2018 at 15:30
2 Answers
Reset to default 2Add @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./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.
版权声明:本文标题:javascript - This experimental syntax requires enabling the parser plugin: 'exportDefaultFrom' - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742220108a2435294.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论