Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using the src directory instead of the lib directory #100

Open
camlough opened this issue Dec 21, 2016 · 3 comments
Open

Using the src directory instead of the lib directory #100

camlough opened this issue Dec 21, 2016 · 3 comments

Comments

@camlough
Copy link

My project seems to be pulling the code from the src directory, which is es6. This is causing the following error:
Module parse failed: .../node_modules/react-search-input/src/index.js Unexpected token

This is being cause by the spread operator.

Any idea why my project isn't pulling the code from the lib directory instead?

@mathieudutour
Copy link
Member

are you using rollup? It's probably following this: https://github.com/enkidevs/react-search-input/blob/master/package.json#L6

@camlough
Copy link
Author

I don't believe i'm using rollup. But that line is clearly what is causing my issue. My solution for now is just to include node_modules in my webpack babel loader

@breezykermo
Copy link

breezykermo commented Aug 7, 2017

This happens for me when installing in conjunction with the latest react boilerplate as well. I get the following error when trying to run webpack:

ERROR in ./node_modules/react-search-input/src/index.js
Module parse failed: /Users/lachlankermode/freelance/cult/plastic-anthony/node_modules/react-search-input/src/index.js Unexpected token (50:112)
You may need an appropriate loader to handle this file type.
| 
|   render () {
|     const {className, onChange, caseSensitive, sortResults, throttle, filterKeys, value, fuzzy, inputClassName, ...inputProps} = this.props // eslint-disable-line no-unused-vars
|     inputProps.type = inputProps.type || 'search'
|     inputProps.value = this.state.searchTerm
 @ dll reactBoilerplateDeps

I fixed this for the time being by removing "src" from the "files" field in the module's package.json, and modifying the "jsnext:main" value from "src/index.js" to "lib/index.js". This allows Babel to parse the file without errors... possibly related to jsforum/jsforum#5

(nb: you can use my fork of the repo if you need it before this get fixed in the NPM package)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants