This repository was archived by the owner on Jan 26, 2019. It is now read-only.
This repository was archived by the owner on Jan 26, 2019. It is now read-only.
"Unexpected token" error if importing jsx #146
Closed
Description
Is this a bug report?
Yes
Can you also reproduce the problem with npm 4.x?
Yes
Which terms did you search for in User Guide?
I search for different combinations of keywords describing using react-scripts-ts for app with both tsx and jsx modules
Environment
npm ls react-scripts-ts
(if you haven’t ejected): react-scripts-ts@2.6.0node -v
: v8.2.1npm -v
: 5.3.0yarn --version
(if you use Yarn): 0.27.5
<<<<<<< HEADnpm ls react-scripts
(if you haven’t ejected):
=======npm ls react-scripts-ts
(if you haven’t ejected):
Fix Code Review
Then, specify:
- Operating system: Win7 SP1 x64
- Browser and version (if relevant): Chrome 60
Steps to Reproduce
I have application with mixed js(x) and ts(x) modules, which I need to coexist and compile properly, however when I rename any of tsx modules to js or jsx, I get the build error:
- create-react-app my-app
- rename src/App.tsx => src/App.jsx
- npm run build
Expected Behavior
Successfully compiled build/dist
Actual Behavior
Actual results:
./src/App.jsx
Module parse failed: c:\temp\test-react-typescript\src\App.jsx Unexpected token (9:6)
You may need an appropriate loader to handle this file type.
| render() {
| return (
| <div className="App">
| <div className="App-header">
| <img src={logo} className="App-logo" alt="logo" />
Reproducible Demo
Please just follow steps, it's very easy to reproduce.