I have a react-native app, which I am running on the web and Android. vector-icon is perfectly working in Android but gives errors in the web version.
Compiled with problems:
×
ERROR in ./node_modules/react-native-vector-icons/lib/create-icon-set.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: D:\Projects\POC's\zingPoc\node_modules\react-native-vector-icons\lib\create-icon-set.js: Support for the experimental syntax 'jsx' isn't currently enabled (91:9):
89 |
90 | return (
> 91 | <Text selectable={false} {...props}>
| ^
92 | {glyph}
93 | {children}
94 | </Text>
Add @babel/preset-react (https://github.com/babel/babel/tree/main/packages/babel-preset-react) to the 'presets' section of your Babel config to enable transformation.
If you want to leave it as-is, add @babel/plugin-syntax-jsx (https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-jsx) to the 'plugins' section to enable parsing.
at instantiate (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:63:32)
at constructor (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:358:12)
at Parser.raise (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:3255:19)
at Parser.expectOnePlugin (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:3301:18)
at Parser.parseExprAtom (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:11245:18)
at Parser.parseExprSubscripts (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:10890:23)
at Parser.parseUpdate (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:10873:21)
at Parser.parseMaybeUnary (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:10849:23)
at Parser.parseMaybeUnaryOrPrivate (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:10687:61)
at Parser.parseExprOps (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:10692:23)
at Parser.parseMaybeConditional (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:10669:23)
at Parser.parseMaybeAssign (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:10630:21)
at D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:10600:39
at Parser.allowInAnd (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:12280:12)
at Parser.parseMaybeAssignAllowIn (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:10600:17)
at Parser.parseParenAndDistinguishExpression (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:11513:28)
at Parser.parseExprAtom (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:11164:23)
at Parser.parseExprSubscripts (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:10890:23)
at Parser.parseUpdate (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:10873:21)
at Parser.parseMaybeUnary (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:10849:23)
at Parser.parseMaybeUnaryOrPrivate (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:10687:61)
at Parser.parseExprOps (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:10692:23)
at Parser.parseMaybeConditional (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:10669:23)
at Parser.parseMaybeAssign (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:10630:21)
at Parser.parseExpressionBase (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:10584:23)
at D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:10580:39
at Parser.allowInAnd (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:12275:16)
at Parser.parseExpression (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:10580:17)
at Parser.parseReturnStatement (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:12999:28)
at Parser.parseStatementContent (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:12617:21)
at Parser.parseStatementLike (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:12584:17)
at Parser.parseStatementListItem (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:12564:17)
at Parser.parseBlockOrModuleBlockBody (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:13185:61)
at Parser.parseBlockBody (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:13178:10)
at Parser.parseBlock (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:13166:10)
at Parser.parseFunctionBody (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:11947:24)
at Parser.parseFunctionBodyAndFinish (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:11933:10)
at Parser.parseMethod (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:11891:31)
at Parser.pushClassMethod (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:13621:30)
at Parser.parseClassMemberWithIsStatic (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:13493:12)
at Parser.parseClassMember (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:13437:10)
at D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:13387:14
at Parser.withSmartMixTopicForbiddingContext (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:12257:14)
at Parser.parseClassBody (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:13367:10)
at Parser.parseClass (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:13345:22)
at Parser.parseStatementContent (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:12613:21)
at Parser.parseStatementLike (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:12584:17)
at Parser.parseStatementListItem (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:12564:17)
at Parser.parseBlockOrModuleBlockBody (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:13185:61)
at Parser.parseBlockBody (D:\Projects\POC's\zingPoc\node_modules\@babel\parser\lib\index.js:13178:10)
I am using babel.config.js
module.exports = function (api) {
const presets = ['module:metro-react-native-babel-preset'];
const plugins = [
'@babel/plugin-syntax-jsx', // Add this line
];
return {
presets,
plugins,
};
};
Environment
web
Description
I have a react-native app, which I am running on the web and Android. vector-icon is perfectly working in Android but gives errors in the web version.
I am using babel.config.js
My package.json
Code where I am using
Please help !!!