dva+antd写的一个react例子--服务器nginx 的配置

Posted shenggen

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了dva+antd写的一个react例子--服务器nginx 的配置相关的知识,希望对你有一定的参考价值。

location ^~ /crm {
        rewrite ^/crm/(.*)(\.js|\.css|\.png|\.jpg|\.jpeg|\.gif|index\.php|robots\.txt)$ /$1$2 break;
        rewrite .* /index.html break;
        root /etc/nginx/static2/CIF_crm-frontend/dist/crm/;
 }

 以上是nginx的配置

{
  "entry": "src/index.js",
  "disableCSSModules": false,
  "cssModulesExclude": ["./src/global.less"],
  "publicPath": "/crm/",
  "outputPath": "./dist/crm",
  "hash": true,
  "theme": {
    "@primary-color": "#5c94d6",
    "@link-color": "#6e97c4",
    "@border-radius-base": "5px",
    "@font-size-base": "12px",
    "@line-height-base": "1.2",
    "@btn-padding-base": "10px 15px",
    "@btn-border-radius-base": "20px",
    "@btn-height-base": "auto",
    "@btn-font-size-lg": "14px",
    "@layout-body-background": "#f5f8fb",
    "@text-color": "#353f51",
    "@layout-sider-background": "#7b9cc6",
    "@layout-trigger-background": "#4c75b3",
    "@menu-dark-bg": "#7b9cc6",
    "@menu-dark-submenu-bg": "#7b9cc6",
    "@table-header-bg": "#fff",
    "@input-border-color": "#d5e3f6",
    "@border-color-base": "#d5e3f6"
  },
  "autoprefixer": null,
  "proxy": {
    "/api": {
      "target": "http://jsonplaceholder.typicode.com/",
      "changeOrigin": true,
      "pathRewrite": { "^/api" : "" }
    },
    "/clms/boss/returnOrder": {
      "target": "http://10.1.1.182:8091/mockjsdata/5",
      "changeOrigin": true,
      "secure": false
    }
  },
  "extraBabelPlugins": [
    "transform-runtime",
    ["import", { "libraryName": "antd", "style": true }]
  ],
  "env": {
    "development": {
      "extraBabelPlugins": [
        "dva-hmr"
      ]
    }
  },
  "xdllPlugin": {
    "exclude": [
      "babel-runtime"
    ],
    "include": [
      "dva/router",
      "dva/saga",
      "dva/fetch"
    ]
  }
}

  

以上是.roadhogrc的配置

------------/^(?!.*\.(css|js)).*$/  正则不包含的css或者js 的正则

以上是关于dva+antd写的一个react例子--服务器nginx 的配置的主要内容,如果未能解决你的问题,请参考以下文章

React + Dva + Antd + Umi 概况

使用 dva + antd 快速开发react应用

react+dva+antd接口调用方式

React+dva+webpack+antd-mobile 实战分享

React+dva+webpack+antd-mobile 实战分享

react实战·菜鸟版1. 用dva + antd 写一个todolist