我开始使用Create React App进行编程,但是我无法理解index.js
如何在index.html
中加载。以下是HTML代码:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<!--
Notice the use of %PUBLIC_URL% in the tag above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start`.
To create a production bundle, use `npm run build`.
-->
</body>
</html>
但是我没有看到任何导入index.js
的地方。它在哪里连接?我错过了什么吗?
create-react-app my-app
并使用WebStorm打开项目,然后运行npm start
,但我的问题是index.html如何知道要加载index.js?在哪里写入? - Pieronpm run eject
手动控制配置。我建议从头开始进行更基本的设置,以充分理解正在发生的事情:) - Nicklas Pouey-Winger