ex-navigator icon indicating copy to clipboard operation
ex-navigator copied to clipboard

import type * as ExRoute from './ExRoute';

Open pavlelekic opened this issue 8 years ago • 3 comments

I'm trying to make a bundle with babel + webpack, and I'm constantly getting this unexpected token error:


ERROR in ./~/@exponent/react-native-navigator/ExNavigator.js
Module parse failed: /Users/Arbor/Desktop/ArborMobileApp/backend/node_modules/@exponent/react-native-navigator/ExNavigator.js Unexpected token (21:12)
You may need an appropriate loader to handle this file type.
| import * as ExNavigatorIcons from './ExNavigatorIcons';
| 
| import type * as ExRoute from './ExRoute';
| 
| export default class ExNavigator extends React.Component {
 @ ./logic/initialize.js 14:175-218

The problem is, I don't know which babel plugin to include in order to solve this problem. Here is my .babelrc file:

{ "presets": ["react-native"], "plugins": ["transform-class-properties"] }

I used "babel-preset-react-native" to enable all the es features used by react, and I also added"babel-plugin-transform-class-properties" in order to support static class properties.

Please help! Thanks.

pavlelekic avatar Apr 11 '16 11:04 pavlelekic

This "import type *" thing looks like Flow annotations, could you please tell me which babel transforms did you use to bundle and run this code? There is no .babelrc file in this repo so I cannot figure it out by myself, or dependencies set in package.json..

pavlelekic avatar Apr 11 '16 14:04 pavlelekic

That is Flow syntax. Search the Babel site for "flow" or grep the babel code base and I think you'll be pointed in the right direction.

ide avatar Apr 11 '16 18:04 ide

I was able to resolve it with. Development server restart as mention on this post https://www.npmjs.com/package/babel-preset-react-native-stage-0

anupkale1984 avatar Oct 11 '16 00:10 anupkale1984