zzzzz124554 中文文档教程

发布于 2年前 浏览 34 更新于 2年前

开始使用 Create React App

该项目是通过 Create React App 启动的。

可用脚本

在项目目录中,您可以运行:

npm start

在开发模式下运行应用程序。\ 打开 http://localhost:3000 在浏览器中查看它。

当您进行更改时,页面将重新加载。\ 您还可能在控制台中看到任何 lint 错误。

npm test

在交互式监视模式下启动测试运行器。\ 有关详细信息,请参阅有关运行测试的部分。

npm run build

将用于生产的应用程序构建到 build 文件夹中。\ 它在生产模式下正确捆绑 React 并优化构建以获得最佳性能。

构建被缩小,文件名包含哈希值。\ 您的应用程序已准备好部署!

有关更多信息,请参阅有关部署的部分。

npm run pop

注意:这是一种单向操作。一旦弹出,就无法返回!

如果您对构建工具和配置选择不满意,可以随时弹出。此命令将从您的项目中删除单个构建依赖项。

相反,它会将所有配置文件和传递依赖项(webpack、Babel、ESLint 等)复制到您的项目中,以便您可以完全控制它们。除了 eject 之外的所有命令仍然有效,但它们将指向复制的脚本,以便您可以调整它们。此时你只能靠自己了。

您不必使用eject。精选的功能集适合中小型部署,您不应该觉得有义务使用此功能。但是我们知道,如果您在准备好使用时无法对其进行自定义,则该工具将没有用处。

了解更多

您可以在创建 React 应用文档中了解更多信息。

要了解 React,请查看 React 文档

代码分割

本节已移至此处:https://facebook.github.io/create-react- app/docs/code-splitting

分析捆绑包大小

此部分已移至此处:https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size

制作渐进式 Web 应用程序

此部分已移至此处:https://facebook.github.io/create-react-app/docs/making-a-progressive -web-app

高级配置

此部分已移至此处:https://facebook. github.io/create-react-app/docs/advanced-configuration

部署

此部分已移至此处:https://facebook.github.io/create-react-app/docs/deployment

npm run build 无法缩小

此部分已移至此处:https://facebook.github.io/create-react-app/docs/故障排除#npm-run-build-fails-to-minify

Getting Started with Create React App

This project was bootstrapped with Create React App.

Available Scripts

In the project directory, you can run:

npm start

Runs the app in the development mode.\ Open http://localhost:3000 to view it in your browser.

The page will reload when you make changes.\ You may also see any lint errors in the console.

npm test

Launches the test runner in the interactive watch mode.\ See the section about running tests for more information.

npm run build

Builds the app for production to the build folder.\ It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.\ Your app is ready to be deployed!

See the section about deployment for more information.

npm run eject

Note: this is a one-way operation. Once you eject, you can't go back!

If you aren't satisfied with the build tool and configuration choices, you can eject at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.

You don't have to ever use eject. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.

Learn More

You can learn more in the Create React App documentation.

To learn React, check out the React documentation.

Code Splitting

This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting

Analyzing the Bundle Size

This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size

Making a Progressive Web App

This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app

Advanced Configuration

This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration

Deployment

This section has moved here: https://facebook.github.io/create-react-app/docs/deployment

npm run build fails to minify

This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文