From 77357aeefefed3460b1ed07bb050c992f078dad4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Thu, 15 Nov 2018 15:00:18 +0800 Subject: [PATCH] fix #2791, product environment removal plugin --- config/plugin.config.js | 43 ++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/config/plugin.config.js b/config/plugin.config.js index 55e8577b..b9e842d2 100644 --- a/config/plugin.config.js +++ b/config/plugin.config.js @@ -5,26 +5,29 @@ import AntDesignThemePlugin from 'antd-theme-webpack-plugin'; import path from 'path'; export default config => { - // 将所有 less 合并为一个供 themePlugin使用 - const outFile = path.join(__dirname, '../.temp/ant-design-pro.less'); - const stylesDir = path.join(__dirname, '../src/'); + // pro 和 开发环境再添加这个插件 + if (process.env.APP_TYPE === 'site' || process.env.NODE_ENV !== 'production') { + // 将所有 less 合并为一个供 themePlugin使用 + const outFile = path.join(__dirname, '../.temp/ant-design-pro.less'); + const stylesDir = path.join(__dirname, '../src/'); - config.plugin('merge-less').use(MergeLessPlugin, [ - { - stylesDir, - outFile, - }, - ]); + 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, '../node_modules/antd/lib/style/themes/default.less'), - mainLessFile: outFile, // themeVariables: ['@primary-color'], - indexFileName: 'index.html', - generateOne: true, - lessUrl: 'https://gw.alipayobjects.com/os/lib/less.js/3.8.1/less.min.js', - }, - ]); + config.plugin('ant-design-theme').use(AntDesignThemePlugin, [ + { + antDir: path.join(__dirname, '../node_modules/antd'), + stylesDir, + varFile: path.join(__dirname, '../node_modules/antd/lib/style/themes/default.less'), + mainLessFile: outFile, // themeVariables: ['@primary-color'], + indexFileName: 'index.html', + generateOne: true, + lessUrl: 'https://gw.alipayobjects.com/os/lib/less.js/3.8.1/less.min.js', + }, + ]); + } }; -- GitLab