Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

reactjs create-react-app missing index.html in src folder

I am using create-react-app command to create an empty app, I got these file in src folder:

App.css
App.js
App.test.js
index.css
index.js
logo.svg
serviceWorker.js
setupTests.js

After I make a build via npm run build, index.html is generated in build folder.

I created one manually in src folder, but the build doesn't take it.

The index.js content is:

ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  document.getElementById('root')
);

There is no root element at all.

I need to add in some <script> tag inside index.html to include some third party scripts (which cannot be installed by nodejs), where can I add them since it is not existed in src folder?

like image 270
Sam YC Avatar asked Dec 05 '25 06:12

Sam YC


1 Answers

You have to check public folder in the root directory only. You will get your index.html would be there. and your index.js file which is in src folder is the single point of connection between them(main index.html in public folder and all Javascript code which is in src folder). enter image description here

like image 109
Adhikansh Mittal Avatar answered Dec 07 '25 20:12

Adhikansh Mittal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!