maxs15 / react-native-spinkit

A collection of animated loading indicators for React Native
MIT License
2.36k stars 300 forks source link

Module parse failed: Unexpected token #99

Open johnreytanquinco opened 5 years ago

johnreytanquinco commented 5 years ago

npm -v 5.6.0

I added "react-native-spinkit": "^1.1.1" in my package.json file then run npm install. I see that package-lock.json was also updated with the package I added. But when I run webpack, I am getting the error message below.

ERROR in ./~/react-native-spinkit/index.js
Module parse failed: /opt/app-root/src/themes/bootstrap_patterns/node_modules/react-native-spinkit/index.js Unexpected token (16:18)
You may need an appropriate loader to handle this file type.
| class Spinkit extends React.Component {
| 
|   static propTypes = {
|       type: PropTypes.string,
|       /**
 @ ./js/index.js 19:26-57
 @ multi ./js/index.js ./webpack.config.js

I just added the Spinner component in my index.js file header and run webpack.

import React from 'react';
import { render } from 'react-dom';
import Chart from './Chart';
import Spinner from 'react-native-spinkit';
...

webpack.config.js

module.exports = {
  entry: ['./js/index.js'],
  output: {
    path: __dirname + "/js/",
    filename: 'favorite.bundle.js'
  },
  module: {
    loaders: [
      {test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader'},
      { test: /\.css$/, loader: "style-loader!css-loader" }
    ]
  }
};