mapbox / mapbox/react-geocoder
trouble with webpack
Open
Nobody has claimed this yet.
enhancement
- Dominant language
- JavaScript
- Stars
- 136
- Forks
- 61
- PR merge metrics
- No merged PRs in 30d
Description
I'm using webpack (with babel-loader), and get this error when I import react-geocoder:
ERROR in ./~/react-geocoder/index.js
Module parse failed: /Users/me/project/node_modules/react-geocoder/index.js Line 9:
Unexpected token (
You may need an appropriate loader to handle this file type.
| */
| var Geocoder = React.createClass({
| getDefaultProps() {
| return {
| endpoint: 'https://api.tiles.mapbox.com',
@ ./static/app/scripts/components/ListProperty/ListPropertyLocationField.jsx 25:21-46
This is most likely a webpack config problem, but I'm hoping someone here knows how to help. My webpack config:
var config = {
entry: './static/app/scripts/main.js',
output: {
path: __dirname,
filename: 'main.js'
},
debug : isDev,
module: {
loaders: [{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel'
}]
}
};
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the webpack configuration and the failing import in react-geocoder/index.js, using static/app/scripts/components/ListProperty/ListPropertyLocationField.jsx and static/app/scripts/main.js as the reproduction path. Run the reported webpack build and verify that importing react-geocoder compiles without the module parse error; no specific test is mentioned.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react, webpack
- Domain
- build-system, frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100