Ant Design Build Plugin for legacy build-scripts

0.1.4 · abandoned · verified Sun Apr 19

build-plugin-antd is a legacy plugin designed for older build-scripts based build systems, specifically to integrate Ant Design components. It provides functionalities for customizing Ant Design's Less variables via `modifyVars` and automatically applies `babel-plugin-import` for on-demand loading of Ant Design components, helping to reduce bundle size. The package is currently at version 0.1.4, indicating it is an early release. Its release cadence is effectively stalled, with no recent updates indicated. It appears to be superseded by `@ice/plugin-antd` in the modern Ice.js ecosystem, which is part of the `@ice/app` framework. As such, `build-plugin-antd` is likely abandoned or in a state of indefinite maintenance. Its primary differentiator was simplifying Ant Design integration within the specific `build-scripts` environment it targeted.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to configure `build-plugin-antd` within an `Ice.js` (or `build-scripts` compatible) project to enable Ant Design component on-demand loading and theme customization using Less `modifyVars`. It shows how the plugin is added to the `plugins` array and how Less options are applied.

import { defineConfig } from '@ice/app'; // Or an equivalent build-scripts defineConfig utility
import antdPlugin from 'build-plugin-antd';

export default defineConfig(() => ({
  // Other build configurations (e.g., output, assets, publicPath)
  // ...

  plugins: [
    // Integrate build-plugin-antd with its configuration options
    antdPlugin({
      // Options for babel-plugin-import, applied to Ant Design components
      libraryDirectory: 'es', // Specifies ES module path for tree-shaking
      style: true,          // Enables Less-based theme customization for Ant Design
      // Additional babel-plugin-import options can be added here
    }),
  ],

  // Configuration for Less variables to customize Ant Design's theme
  // This typically integrates with the underlying Less loader setup
  less: {
    modifyVars: {
      '@primary-color': '#007bff', // Example: Change primary color to blue
      '@link-color': '#007bff',
      '@border-radius-base': '4px',
      '@success-color': '#52c41a',
    },
    javascriptEnabled: true, // Required for Ant Design's Less theme variables
  },
  // ... additional build configurations for Ice.js or build-scripts
}));

view raw JSON →