对jsx的React File命名约定

Sha*_*P S 7 node.js npm reactjs react-jsx

我是新来的反应.最初我开始使用create-react-app.文件名是index.js默认的.然后我将文件重命名为index.jsx.

当我尝试启动应用程序时,npm start我收到以下错误.

> react-scripts start

Could not find a required file.
  Name: index.js
  Searched in: D:\WorkSpace\React\chat\src

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "D:\\Applns\\nodejs\\node.exe" "D:\\Applns\\nodejs\\node_modules\\
npm\\bin\\npm-cli.js" "start"
npm ERR! node v6.10.0
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! chat@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the chat@0.1.0 start script 'react-scripts start'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the chat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
Run Code Online (Sandbox Code Playgroud)

如何解决这个问题.如何让节点获取jsx文件.

KA0*_*A01 0

具有该扩展名的文件正在由另一个文件导入。扩展名已更改,因此查找将失败。此外,React 不需要这些文件才能.jsx工作。因此,只需将文件扩展名切换回来就可以了。我从未使用过create-react-app,但如果您不想让它工作,.jsx您很可能必须在默认配置的基础上进行一些额外的配置。我会为此查看文档。