Jsx file naming convention

I am new to reaction. At first I started using create-react-app. By default, file names were index.js. Then I renamed the file to index.jsx.

When I try to run the application using npm start, I get the following error.

> 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:

How to resolve this. How can I make node to take jsx file.

+6
source share
3 answers

. , . , React .jsx . . create-react-app, .jsx, , . .

0

index.js index.jsx, , create-eact-app

0

@KeithA - . webpack.config.js resolve:

resolve: {
 ///...some other configurations will go here ...

  extensions: [ "", ".js", ".jsx" ]
},
0

Source: https://habr.com/ru/post/1016908/


All Articles