前端

React+Koa服务端渲染(SSR同构)项目基本目录结构、package.json

2019-08-07聚力创意

// 项目基本目录

.
├── build  // webpack配置文件
├── dist  // 打包目录
├── node_modules  // 模块文件
├── src // 资源文件
│   ├── api // 接口文件
│   ├── assets  // 未编译的css、图片等资源文件
│   ├── client // 客户端入口文件
│   ├── config // 配置文件夹
│   ├── server // 服务端入口文件
│   ├── store // 公用redux文件
│   ├── utils // 工具文件
│   ├── views // 页面文件
│   └── routes.js // 路由配置文件
├── .postcssrc.js // postcss 配置文件
├── index.html // 自定义模板文件
├── package.json
├── .babelrc  // babel 配置文件
└── static // 静态资源文件
// package.json

{
  "scripts": {
    "dev": "npm-run-all --parallel dev:**",
    "dev:server": "cross-env NODE_ENV=development webpack --config build/webpack.conf.server.js --watch",
    "dev:client": "webpack --config build/webpack.conf.client.dev.js --watch",
    "dev:start": "nodemon dist/static/server.js",
    "build": "rimraf dist && npm-run-all --parallel build:**",
    "build:server": "webpack --config build/webpack.conf.server.js",
    "build:client": "webpack --config build/webpack.conf.client.prod.js",
    "start": "nodemon dist/static/server.js"
  },
  "devDependencies": {
    "@babel/core": "^7.5.4",
    "@babel/polyfill": "^7.4.4",
    "@babel/preset-env": "^7.5.4",
    "@babel/preset-react": "^7.0.0",
    "@babel/plugin-proposal-class-properties": "^7.5.0",
    "autoprefixer": "^9.6.1",
    "babel-loader": "^8.0.6",
    "babel-plugin-prismjs": "^1.1.1",
    "cross-env": "^5.2.0",
    "css-loader": "^3.0.0",
    "html-webpack-plugin": "^3.2.0",
    "isomorphic-style-loader": "^5.1.0",
    "mini-css-extract-plugin": "^0.7.0",
    "node-sass": "^4.12.0",
    "nodemon": "^1.19.1",
    "optimize-css-assets-webpack-plugin": "^5.0.3",
    "postcss-loader": "^3.0.0",
    "sass-loader": "^7.1.0",
    "style-loader": "^0.23.1",
    "url-loader": "^2.0.1",
    "webpack": "^4.35.3",
    "webpack-cli": "^3.3.5",
    "webpack-dev-server": "^3.7.2",
    "webpack-merge": "^4.2.1",
    "webpack-node-externals": "^1.7.2",
    "vconsole": "^3.3.2"
  },
  "dependencies": {
    "axios": "^0.19.0",
    "koa": "^2.7.0",
    "koa-compress": "^3.0.0",
    "koa-static": "^5.0.0",
    "koa-static-cache": "^5.1.2",
    "npm-run-all": "^4.1.5",
    "react": "^16.8.6",
    "react-dom": "^16.8.6",
    "react-helmet": "^5.2.1",
    "react-lazyload": "^2.6.2",
    "react-redux": "^7.1.0",
    "react-router-config": "^5.0.1",
    "react-router-dom": "^5.0.1",
    "react-slick": "^0.24.0",
    "redux": "^4.0.4",
    "redux-devtools-extension": "^2.13.8",
    "redux-thunk": "^2.3.0",
    "slick-carousel": "^1.8.1"
  }
}
蜀ICP备17044229号