Syntax error during bundling with JavaScript project
See original GitHub issueHi all, I’m facing a syntax error with the bundling of the app of the app in my JavaScript project. For some reason Babel isn’t able to transpile tsx in the library to JS and I’m not sure how to debug this so I’m creating a new issue since there didn’t seem to be any existing ones previously.
Dependencies:
- “react-native-paper”: “^4.2.0”,
- “react-native”: “0.61.5”,
- “@babel/core”: “^7.5.5”,
- “@babel/preset-flow”: “^7.0.0”,
- “@babel/runtime”: “^7.5.5”,
- “babel-eslint”: “^10.0.3”,
- “babel-jest”: “^24.8.0”,
- “babel-plugin-transform-inline-environment-variables”: “^0.4.3”,
- “react-native-vector-icons”: “^6.4.2”
My babel.config.js:
const path = require('path')
const pak = require('./package.json');
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
env: {
production: {
plugins: ['react-native-paper/babel'],
},
},
};
Error output (comes after running npm run start-android
):
BUNDLE [android, dev] ./index.js ▓▓▓▓▓▓▓▓▓▓░░░░░░ 68.4% (2010/2430)::ffff:192.168.1.121 - - [29/Sep/2020:04:11:07 +0000] "GET /index.bundle?pl
error: bundling failed: SyntaxError: /home/tehtea/thisapp/node_modules/react-native-paper/src/components/Chip.tsx: Unexpected token (14:12)
12 | } from 'react-native';
13 | import color from 'color';
> 14 | import type { IconSource } from './Icon';
| ^
15 | import Icon from './Icon';
16 | import MaterialCommunityIcon from './MaterialCommunityIcon';
17 | import Surface from './Surface';
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
Unexpected token < bundle js:1 - Stack Overflow
Its a project for practice how bundle files. The console show me: bundle.js:1 Uncaught SyntaxError: Unexpected token '<'. Its refers to the html ......
Read more >SyntaxError - JavaScript - MDN Web Docs
The SyntaxError object represents an error when trying to interpret syntactically invalid code. It is thrown when the JavaScript engine encounters tokens or ......
Read more >Syntax Error during deploy --build command step bundling ...
Hi, i am experiencing an issue using netlify-cli to build and deploy a site with some netlify functions. Locally using netlify dev command ......
Read more >rollup.js
Once you're finished with the bundle object, you should call bundle.close() , which will let plugins clean up their external processes or services...
Read more >Modules in JavaScript – CommonJS and ESmodules Explained
Instead of having all of our program's components in a single file, ... SyntaxError: Cannot use import statement outside a module.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
What a dumb error. It was caused by an outdated version of babel. Fixed it by upgrading both
@babel/core
and@babel/runtime
from7.5.5
to7.8.4
. See a similar error in another project here: https://github.com/react-navigation/react-navigation/issues/7981@tehtea I upgraded it and the problem gone. Thanks @tehtea