Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Jonathan Mitten
PLUS
Jonathan Mitten
Courses Plus Student 11,197 Points

react-basics doesn't use app.js

The webpack.config.js entry point is configured in the video to point to './app.js'. However, the react-basics course where we built the scoreboard app didn't use an app.js file, but rather an app.jsx file.

So, when I run webpack from the command line, I get this error:

ERROR in Entry module not found: Error: Can't resolve './app.js' in '/react-basics'

When I changed the filename to './app.jsx', I get the error:

ERROR in ./app.jsx
Module parse failed: Unexpected token (27:4)
You may need an appropriate loader to handle this file type.

I built the React Basics app locally and committed to github, where the React Basics course is currently at master: https://github.com/jonmitten/react-basics

What should I do to fix this jsx issue?

1 Answer

Seth Kroger
Seth Kroger
56,413 Points

In general, if you are using webpack with React it should pipe all of the JavaScript files (*.js) through Babel for you to handle the JSX. So you should be fine with changing the filename to app.js when converting to project over to webpack.

Seth Kroger
Seth Kroger
56,413 Points

Also see this workshop which goes through step-by-step converting the react-basic project to webpack: https://teamtreehouse.com/library/setting-up-webpack-for-react