reactjs / react-autocomplete

WAI-ARIA compliant React autocomplete (combobox) component
MIT License
2.17k stars 532 forks source link

"Module parse failed" at import #206

Closed kedare closed 7 years ago

kedare commented 7 years ago

Hello,

When trying to import this module, I'm getting an error :

Error in ./~/react-autocomplete/lib/Autocomplete.js
Module parse failed: /Users/kedare/Documents/Repositories/xxx-react-frontend/node_modules/react-autocomplete/lib/Autocomplete.js Unexpected token (39:15)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (39:15)
 @ ./src/pages/FrontPage.js 27:20-66

Is this a known issue ? Removing the import line remove the error :

import Autocomplete from 'react-autocomplete/lib/Autocomplete';

Am I missing something ?

Thanks.

CMTegner commented 7 years ago

The main file in the Autocomplete package is ./build/lib/Autocomplete.js, although you shouldn't be requiring this directly since the internal hierarchy may change without necessarily causing a major semver bump.

Instead of doing import Autocomplete from 'react-autocomplete/lib/Autocomplete', simply do import Autocomplete from 'react-autocomplete'.