React项目配置

React

1.默认项目结构

my-app/
  README.md
  #依赖
  node_modules/
  #打包即配置文件
  package.json
  .gitignore
  #`npm run build` 命令后  打包存放的目录
  public/
    favicon.ico
    index.html
    #指定了开始页面 index.html
    manifest.json
  #自己开发的项目文件
  src/
    App.css
    #入口类文件
    App.js
    App.test.js
    index.css
    index.js
    logo.svg

2.我的项目结构

create-react-app + react+antd-mobile

my-app/
  README.md
  #依赖
  node_modules/
  #打包即配置文件
  package.json
  .gitignore
  #`npm run build` 命令后  打包存放的目录
  public/
    favicon.ico
    index.html
    #指定了开始页面 index.html
    manifest.json
  #自己开发的项目文件
  src/
    #接口相关
    api
    #跟域名访问的目录
    components
    #配置文件
    config
    #图片
    images
    #每个页面的路径
    pages
    #样式
    style
    #存放一些公用方法
    utils
    #入口文件
    App.js
    App.test.js
    index.css
    index.js
    logo.svg
    #缓存资源到本地,提升应用的访问速度
    registerServiceWorker.js
    #路由文件
    router.js
    #webpack 配置
    config-overrides.js

3.package.json修改

添加"homepage": "https://m.huhustory.com"
添加"dependencies"

"dependencies": {
    "antd-mobile": "^2.2.2",
    "axios": "^0.18.0",
    "callapp-lib": "^1.7.2",
    "copy-to-clipboard": "^3.0.8",
    "js-cookie": "^2.2.0",
    "react": "^16.4.1",
    "react-document-title": "^2.0.3",
    "react-dom": "^16.4.1",
    "react-router-dom": "^4.3.1",
    "react-scripts": "1.1.4",
    "weixin-js-sdk": "^1.4.0-test"
  }

添加"scripts"

"scripts": {
    "start": "react-app-rewired start",
    "build": "react-app-rewired build",
    "test": "react-app-rewired test --env=jsdom",
    "eject": "react-scripts eject"
  }
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容