Skip to content
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
@pmunin

Description

@pmunin

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

  1. npm ls react-scripts-ts (if you haven’t ejected): react-scripts-ts@2.6.0
  2. node -v: v8.2.1
  3. npm -v: 5.3.0
  4. yarn --version (if you use Yarn): 0.27.5
    <<<<<<< HEAD
  5. npm ls react-scripts (if you haven’t ejected):
    =======
  6. npm ls react-scripts-ts (if you haven’t ejected):

Fix Code Review

Then, specify:

  1. Operating system: Win7 SP1 x64
  2. 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:

  1. create-react-app my-app
  2. rename src/App.tsx => src/App.jsx
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions