我的react应用(我认为它基于create-react-app-我最初没有创建它)
不使用index.html,它具有index.js,还有一些index.js,
我想知道它是如何工作的?基本上,当我运行npm run build时,没有创建build文件夹,创建了es和lib文件夹,它们是src文件夹(包含组件)的副本
为什么要创建这两个文件夹而不是构建文件夹?
我使用了一个npm软件包:https://www.npmjs.com/package/react-chat-window
这是我的package.json(可能会提示):
我真的很想理解,因为在我的服务器上,我正在使用nginx,但是它没有路由到任何文件,可用的站点/默认站点不会路由到其默认设置,因此它如何工作! / p>
{
"name": "react-chat-window",
"version": "1.0.8",
"description": "react-live-chat React component",
"main": "lib/index.js",
"module": "es/index.js",
"files": [
"css",
"es",
"lib",
"umd"
],
"scripts": {
"build": "nwb build-react-component --copy-files",
"clean": "nwb clean-module && nwb clean-demo",
"start": " nwb serve-react-demo",
"gh:publish": "nwb build-demo && gh-pages -d demo/dist"
},
"dependencies": {
"@material-ui/core": "^3.2.0",
"emoji-js": "3.2.2",
"fs": "0.0.1-security",
"gh-pages": "^1.0.0",
"material-ui": "^0.20.2",
"moment": "^2.24.0",
"prop-types": "15.5.10",
"react-highlight.js": "1.0.5",
"react-slick": "^0.23.2",
"slick-carousel": "^1.8.1",
"socket.io-client": "2.0.3"
},
"peerDependencies": {
"react": "16.6.0",
"react-dom": "^16.6.0"
},
"devDependencies": {
"nwb": "0.17.x",
"react": "^16.6.0",
"react-dom": "^16.6.0"
},
"author": "",
"homepage": "",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/kingofthestack/react-live-chat.git"
},
"keywords": [
"react-component"
]
}
答案 0 :(得分:1)
您没有使用create-react-app,而是使用了另一个名为nwb的样板,这是他的官方文档,以了解其工作原理https://github.com/insin/nwb,这是他有关react https://github.com/insin/nwb/blob/master/docs/guides/ReactApps.md#developing-react-apps-with-nwb