joaocarmo/react-smart-data-table

import SmartDataTable from 'react-smart-data-table' causing module parse failed

binyata opened this issue ยท 15 comments

I think this would be an awesome library to use for a reactjs application, but it looks like I cannot even import SmartDataTable.

Details on error:

./node_modules/react-smart-data-table/lib/SmartDataTable.js
Module parse failed: /Users/ryanlee/src/live-alerts-frontend/live-alerts/node_modules/react-smart-data-table/lib/SmartDataTable.js Unexpected token (114:6)
You may need an appropriate loader to handle this file type.
| ) : 'rsdt-sortable-icon'
| return (
| <i className={'rsdt ' + sortingIcon} onClick={(e) => { this.handleSortChange(column) }} />
| );
| }

I am also facing the same problem. Have any idea?

I don't know how responsive this github user is, but we may end up having to fork this to a different repo to resolve the bug.

So long as you can parse ES6, this should be fine. I need more information in order to debug the question. Do you use webpack? Are you using babel? It should suffice.

for me I am using the create-react-app command to build the sample build, then I ran npm to install your package. I simply imported the smartdatatable package, and ran into the error message I pasted up above.

Same for me. I am also using create-react-app and the error was exactly same as issue description.

Are you importing React as well? React is a peer dependency and needs to be independently imported.

Absolutely. I have imported React like,
import React, {Component} from "react";

I have exactly the same issue and can't find out what is wrong. I am using webpack and babel.

+1 I am having the same issue too. Using create-react-app which definitely uses webpack and I presume uses babel behind the scenes.

Same error, unexpected token at (114:6), same code snippet shown, same "you may need an appropriate loader" message.

Bueller...

I'm have almost 0 experience with webpack so I can't help a lot. But what I find worth mentioning:
When you start with create-react-app and simply copy this repo to your source folder, everything works fine!
I guess the webpack config just excludes to whole node_modules folder for the babel-loader or something? ๐Ÿค”

So let's all npm run eject and find a solution ;-)

Please, check my answer to issue #6.

I have the same problem. All other plugins work without a problem except this one, and i dont use webpack

@emrbzr which module bundler do you use?

I will be closing this now as it seems no answer is coming.