mirror of
https://github.com/zuiidea/antd-admin.git
synced 2024-04-21 12:32:14 +00:00
refact: migrate to umi@2
This commit is contained in:
@@ -1,26 +1,69 @@
|
||||
import {resolve} from "path";
|
||||
|
||||
export default {
|
||||
plugins: [
|
||||
'umi-plugin-dva',
|
||||
[
|
||||
'umi-plugin-routes',
|
||||
'umi-plugin-react',
|
||||
{
|
||||
exclude: [
|
||||
/model\.(j|t)sx?$/,
|
||||
/service\.(j|t)sx?$/,
|
||||
/models\//,
|
||||
/components\//,
|
||||
/services\//,
|
||||
/chart\/Container\.js$/,
|
||||
],
|
||||
},
|
||||
],
|
||||
[
|
||||
'umi-plugin-dll',
|
||||
{
|
||||
exclude: [],
|
||||
include: ["dva", "dva/router", "dva/saga", "dva/fetch", "antd/es"],
|
||||
dva: true,
|
||||
antd: true,
|
||||
routes: {
|
||||
exclude: [
|
||||
/model\.(j|t)sx?$/,
|
||||
/service\.(j|t)sx?$/,
|
||||
/models\//,
|
||||
/components\//,
|
||||
/services\//,
|
||||
/chart\/Container\.js$/,
|
||||
/chart\/ECharts\/.+Component\.js$/,
|
||||
/chart\/ECharts\/.+ComPonent\.js$/,
|
||||
/chart\/ECharts\/theme\/.+\.js$/,
|
||||
/chart\/highCharts\/.+Component\.js$/,
|
||||
/chart\/highCharts\/mapdata\/.+\.js$/,
|
||||
/chart\/Recharts\/.+Component\.js$/,
|
||||
/chart\/Recharts\/Container\.js$/,
|
||||
],
|
||||
},
|
||||
dll: {
|
||||
exclude: [],
|
||||
include: ["dva", "dva/router", "dva/saga", "dva/fetch", "antd/es"],
|
||||
},
|
||||
hardSource: /* isMac */process.platform === 'darwin',
|
||||
},
|
||||
],
|
||||
],
|
||||
theme: "./theme.config.js",
|
||||
// 接口代理示例
|
||||
proxy: {
|
||||
"/api/v1/weather": {
|
||||
"target": "https://api.seniverse.com/",
|
||||
"changeOrigin": true,
|
||||
"pathRewrite": { "^/api/v1/weather": "/v3/weather" }
|
||||
},
|
||||
// "/api/v2": {
|
||||
// "target": "http://192.168.0.110",
|
||||
// "changeOrigin": true,
|
||||
// "pathRewrite": { "^/api/v2" : "/api/v2" }
|
||||
// }
|
||||
},
|
||||
alias: {
|
||||
themes: resolve(__dirname, './src/themes'),
|
||||
components: resolve(__dirname,"./src/components"),
|
||||
utils: resolve(__dirname,"./src/utils"),
|
||||
config: resolve(__dirname,"./src/utils/config"),
|
||||
enums: resolve(__dirname,"./src/utils/enums"),
|
||||
services: resolve(__dirname,"./src/services"),
|
||||
models: resolve(__dirname,"./src/models"),
|
||||
routes: resolve(__dirname,"./src/routes"),
|
||||
},
|
||||
urlLoaderExcludes: [
|
||||
/\.svg$/,
|
||||
],
|
||||
ignoreMomentLocale: true,
|
||||
chainWebpack(config) {
|
||||
config.module.rule('svg')
|
||||
.test(/\.svg$/i)
|
||||
.use('svg-sprite-loader')
|
||||
.loader(require.resolve('svg-sprite-loader'));
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
|
||||
export default {
|
||||
...require('./mock/common'),
|
||||
...require('./mock/dashboard'),
|
||||
...require('./mock/menu'),
|
||||
...require('./mock/post'),
|
||||
...require('./mock/user'),
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
import { resolve } from 'path';
|
||||
|
||||
export default {
|
||||
theme: "./theme.config.js",
|
||||
// 接口代理示例
|
||||
proxy: {
|
||||
"/api/v1/weather": {
|
||||
"target": "https://api.seniverse.com/",
|
||||
"changeOrigin": true,
|
||||
"pathRewrite": { "^/api/v1/weather": "/v3/weather" }
|
||||
},
|
||||
// "/api/v2": {
|
||||
// "target": "http://192.168.0.110",
|
||||
// "changeOrigin": true,
|
||||
// "pathRewrite": { "^/api/v2" : "/api/v2" }
|
||||
// }
|
||||
},
|
||||
alias: {
|
||||
themes: resolve(__dirname, './src/themes'),
|
||||
components: resolve(__dirname,"./src/components"),
|
||||
utils: resolve(__dirname,"./src/utils"),
|
||||
config: resolve(__dirname,"./src/utils/config"),
|
||||
enums: resolve(__dirname,"./src/utils/enums"),
|
||||
services: resolve(__dirname,"./src/services"),
|
||||
models: resolve(__dirname,"./src/models"),
|
||||
routes: resolve(__dirname,"./src/routes"),
|
||||
},
|
||||
urlLoaderExcludes: [
|
||||
/\.svg$/,
|
||||
],
|
||||
ignoreMomentLocale: true,
|
||||
}
|
||||
+5
-7
@@ -47,19 +47,17 @@
|
||||
"less-vars-to-js": "^1.1.2",
|
||||
"mockjs": "^1.0.1-beta3",
|
||||
"svg-sprite-loader": "^3.9.0",
|
||||
"umi": "^1.3.17",
|
||||
"umi-plugin-dll": "^0.2.1",
|
||||
"umi-plugin-dva": "^0.9.1",
|
||||
"umi-plugin-routes": "^0.1.5"
|
||||
"umi": "^2.0.0-beta.16",
|
||||
"umi-plugin-react": "^1.0.0-beta.16"
|
||||
},
|
||||
"pre-commit": [
|
||||
"lint"
|
||||
],
|
||||
"scripts": {
|
||||
"analyze": "cross-env ANALYZE=1 BABELRC=1 umi build",
|
||||
"start": "cross-env BABELRC=1 COMPILE_ON_DEMAND=none BROWSER=none HOST=0.0.0.0 umi dev",
|
||||
"analyze": "cross-env ANALYZE=1 umi build",
|
||||
"start": "umi dev",
|
||||
"lint": "eslint --fix --ext .js src",
|
||||
"build": "cross-env BABELRC=1 umi build",
|
||||
"build": "umi build",
|
||||
"test": "umi test"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import { convertToRaw } from 'draft-js'
|
||||
import { Row, Col, Card } from 'antd'
|
||||
import draftToHtml from 'draftjs-to-html'
|
||||
import draftToMarkdown from 'draftjs-to-markdown'
|
||||
// https://github.com/jpuri/react-draft-wysiwyg/blob/master/docs/src/components/Demo/index.js
|
||||
|
||||
export default class EditorPage extends React.Component {
|
||||
constructor (props) {
|
||||
|
||||
@@ -2,7 +2,7 @@ import React from 'react'
|
||||
import { Radio } from 'antd'
|
||||
import { Page } from 'components'
|
||||
import EchartsComponent from './EchartsComponent'
|
||||
import styles from './page.less'
|
||||
import styles from './index.less'
|
||||
|
||||
const RadioGroup = Radio.Group
|
||||
|
||||
@@ -2,7 +2,7 @@ import React from 'react'
|
||||
import { Radio } from 'antd'
|
||||
import { Page } from 'components'
|
||||
import ReChartsComponent from './ReChartsComponent'
|
||||
import styles from './page.less'
|
||||
import styles from './index.less'
|
||||
|
||||
const RadioGroup = Radio.Group
|
||||
|
||||
@@ -2,7 +2,7 @@ import React from 'react'
|
||||
import { Radio } from 'antd'
|
||||
import { Page } from 'components'
|
||||
import HighChartsComponent from './HighChartsComponent'
|
||||
import styles from './page.less'
|
||||
import styles from './index.less'
|
||||
|
||||
const RadioGroup = Radio.Group
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
|
||||
export default function (webpackConfig) {
|
||||
webpackConfig.module.rules.push({
|
||||
test: /\.svg$/i,
|
||||
use: [
|
||||
{
|
||||
loader: require.resolve('svg-sprite-loader'),
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
return webpackConfig
|
||||
};
|
||||
Reference in New Issue
Block a user