You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
2.0 KiB
70 lines
2.0 KiB
// Change theme plugin |
|
|
|
// import MergeLessPlugin from 'antd-pro-merge-less'; |
|
import AntDesignThemePlugin from 'antd-theme-webpack-plugin'; |
|
import path from 'path'; |
|
|
|
import MergeLessPlugin from '../scripts/mergeLessPlugin'; |
|
import { THEME_CHANGES_VARS } from '../src/config/constant'; |
|
|
|
//const eslintFormatter = require('react-dev-utils/eslintFormatter'); |
|
const fs = require('fs'); |
|
|
|
const appDirectory = fs.realpathSync(process.cwd()); |
|
const resolveApp = relativePath => path.resolve(appDirectory, relativePath); |
|
export default config => { |
|
// 将所有 less 合并为一个供 themePlugin使用 |
|
const outFile = path.join(__dirname, `..${path.sep}.temp${path.sep}ant-design-pro.less`); |
|
const stylesDir = path.join(__dirname, `..${path.sep}src${path.sep}`); |
|
|
|
config.plugin('merge-less').use(MergeLessPlugin, [ |
|
{ |
|
stylesDir, |
|
outFile, |
|
}, |
|
]); |
|
|
|
config.plugin('ant-design-theme').use(AntDesignThemePlugin, [ |
|
{ |
|
antDir: path.join(__dirname, '../node_modules/antd'), |
|
stylesDir, |
|
varFile: path.join(__dirname, '../src/themes/lightblue/lightblue.style.less'), |
|
mainLessFile: outFile, |
|
themeVariables: THEME_CHANGES_VARS, |
|
indexFileName: 'index.html', |
|
publicPath: '/HiatmpPro', |
|
generateOnce: false, |
|
lessUrl: './less.min.js', |
|
}, |
|
]); |
|
/* config.optimization.splitChunks({ |
|
cacheGroups: { |
|
styles: { |
|
name: 'styles', |
|
test: /\.(css|less)$/, |
|
chunks: 'async', |
|
minChunks: 1, |
|
minSize: 0, |
|
}, |
|
}, |
|
});*/ |
|
/* |
|
[umi中如何增加eslint-loader实现代码动态检测](https://github.com/umijs/umi/issues/1371) |
|
umi2.4 已经支持了 .env 文件 配置 ESLINT ,默认不打开 ,放着只是为了看见webpack 怎么配置 |
|
*/ |
|
|
|
/* config.module |
|
.rule('lint') |
|
.test(/.(js|jsx|mjs)$/) |
|
.pre() |
|
.include |
|
.add(resolveApp('src')) |
|
.end() |
|
// Even create named uses (loaders) |
|
.use('eslint') |
|
.loader(require.resolve('eslint-loader')) |
|
.options({ |
|
formatter: eslintFormatter, |
|
eslintPath: require.resolve('eslint'), |
|
});*/ |
|
};
|
|
|