maxs15 / maxs15/react-native-spinkit

Module parse failed: Unexpected token

Open
#99 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Objective-C
Stars
2.4k
Forks
307
PR merge metrics
No merged PRs in 30d

Description

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" }
    ]
  }
};

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read webpack.config.js and node_modules/react-native-spinkit/index.js, starting at the reported parse error on line 16 and the Babel loader rule. Run webpack with the Spinner import shown in js/index.js and inspect how the dependency is handled. Done means the bundle builds without the module parse error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react, react-native, webpack
Domain
build-system, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.