简体   繁体   中英

Customize Antd in ejected CRA

I've got a fresh CRA made, and I am using the Ant Design library. Looking at the instructions, it's not 100% clear to me what exactly I need to do, however from what I can gather, since I have ejected my app, I can modify my webpack.config.js file and be done with it.

Unfortunately, it seems the changes I have made are not being reflected

I have added the below into my rules array

    {
      test: /\.less$/,
      use: [{
        loader: require.resolve('style-loader'),
      }, {
        loader: require.resolve('css-loader'), // translates CSS into CommonJS
      }, {
        loader: require.resolve('less-loader'), // compiles Less to CSS
        options: {
          modifyVars: {
            'primary-color': '#1DA57A',
            'link-color': '#1DA57A',
            'border-radius-base': '2px',
          },
          javascriptEnabled: true,
        },
      }],
    },

Does anyone know how I can get this working please?

Instead of ejecting. You can use customize-cra package to override default settings. Ant design has already added the docs on the usage for create react app. Please check this link .

Hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM