webpack.config.js 627 B

12345678910111213141516171819
  1. import AntDesignThemePlugin from 'antd-theme-webpack-plugin';
  2. const path = require('path');
  3. export default webpackConfig => {
  4. const options = {
  5. antDir: path.join(__dirname, './node_modules/antd'),
  6. stylesDir: path.join(__dirname, './src'),
  7. varFile: path.join(__dirname, './node_modules/antd/lib/style/themes/default.less'),
  8. mainLessFile: path.join(__dirname, './src/index.less'),
  9. themeVariables: ['@primary-color'],
  10. indexFileName: 'index.html',
  11. };
  12. const themePlugin = new AntDesignThemePlugin(options);
  13. // in config object
  14. webpackConfig.plugins.push(themePlugin);
  15. return webpackConfig;
  16. };