@cake-fxd/cake-cli-presets
Version:
蛋糕英语前端模版项目集合
67 lines (60 loc) • 1.65 kB
text/typescript
import { IConfig } from 'umi-types'
import p2r from 'postcss-plugin-px2rem'
const isDev: boolean = process.env.NODE_ENV === 'development'
// 是否是h5项目(手机端)
const isH5Project: boolean = false
// ref: https://umijs.org/config/
const config: IConfig = {
treeShaking: true,
hash: true, // 每次都生成不同的hash值
routes: [
{
path: '/',
component: '../layouts/index',
routes: [{ path: '/', component: '../pages/home' }],
},
],
publicPath: '//ali.bczcdn.com/paplab/web/{{projectName}}/dist/',
plugins: [
// ref: https://umijs.org/plugin/umi-plugin-react.html
[
'umi-plugin-react',
{
antd: false,
dva: true,
dynamicImport: { webpackChunkName: true },
title: '{{projectName}}',
dll: false,
routes: {
exclude: [/models\//, /services\//, /model\.(t|j)sx?$/, /service\.(t|j)sx?$/, /components\//],
},
},
],
],
cssLoaderOptions: {
localIdentName: isDev ? '[local]_[hash:8]' : '[hash:6]',
},
extraPostCSSPlugins: [
isH5Project &&
p2r({
rootValue: 75, // 根节点fontSize,二倍图为75 一倍图为37.5
unitPrecision: 5,
propWhiteList: [],
// propBlackList: ['font-size'],
exclude: /(node_module)/,
selectorBlackList: [],
ignoreIdentifier: false,
replace: true,
mediaQuery: false,
minPixelValue: 1,
}),
].filter(Boolean),
proxy: {
// '/api/*': {
// target: 'http://www.xxx.com/',
// changeOrigin: true,
// secure: false,
// },
},
}
export default config