我使用以下命令创建了一个非常基本的 hello world ReactJs 应用程序create-react-app
命令是 npm 的一部分。这是我作为应用程序模板的一部分获得的目录结构:
My package.json
文件看起来像这样:
{
"name": "hello-world",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^15.4.2",
"react-dom": "^15.4.2"
},
"devDependencies": {
"react-scripts": "0.9.5"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
我观察到每次表演时npm run build
它使用的命令index.html
存在于public
目录和index.js
存在于src
创建最终生产版本的目录build
目录。我确信这种情况正在发生,因为所有内部管道都是通过 npm 进行的。有人可以帮助我了解这是如何发生的以及如何将这些目标文件更改为我自己的自定义文件,名为HelloWorld.html
(存在于public
目录)和myApp.js
(存在于src
目录)?
如果你想更改构建配置,你可以运行npm run eject
这将从您的项目中删除构建依赖项,并将配置文件添加到您的项目中,允许您根据需要更改它们。
https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#npm-run-eject https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#npm-run-eject
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)