DocSpring / craco-antd

A craco plugin to use Ant Design with create-react-app
MIT License
234 stars 49 forks source link

Adds support for CRA 5 and craco-less 2 #75

Closed kamronbatman closed 2 years ago

kamronbatman commented 2 years ago

Note: resolve-url-loader, sass-loader, and less-loader now default to sourceMap true for development. Decided to lean into this instead of fighting with it. Check their appropriate docs for their reasoning behind this.

Closes #74, #73, #68, #59, #55, #51

Security Warnings: Closes #77, #70, #69, #66, #65, #63, #61, #58, #57, #56, #53

kamronbatman commented 2 years ago

There was a change to the less rule postcss options structure. Does this warrant bumping craco-antd to 2.0?

huynguyenchk commented 2 years ago

Hope to see this merge

kamronbatman commented 2 years ago

@huynguyenchk until this gets merged, I have published this under @mrbatman/craco-antd.

kamronbatman commented 2 years ago

@ndbroadbent, anything I can do to help get movement on this? Thank you!

matart15 commented 2 years ago

waiting this to be merged

flyingcrp commented 2 years ago

any progress for this ?

matart15 commented 2 years ago

Just letting you know. I Change to this. https://github.com/tommie-lie/cra-antd-customization

Now I am not even using craco

nerdess commented 2 years ago

I want to use craco (I need it for the webpack aliases). To support less (which antd needs for customisation) I switched from craco-antd to craco-less which seems to be the better maintained plugin.

this is my craco.config.js to get antd to work

//const CracoAntDesignPlugin = require('craco-antd');
const CracoLessPlugin = require("craco-less");
const path = require('path');

module.exports = {
webpack: {
    alias: {
        "@components": path.resolve(__dirname, "src/components/"),
        "@util": path.resolve(__dirname, "src/util/"),
        "@pages": path.resolve(__dirname, "src/pages/"),
        "@images": path.resolve(__dirname, "src/images/"),
        "@context": path.resolve(__dirname, "src/context/"),
        "@hooks": path.resolve(__dirname, "src/hooks/"),

    },
    plugins: {
        add: [] /* An array of plugins */,
        remove: [] /* An array of plugin constructor's names (i.e. "StyleLintPlugin", "ESLintWebpackPlugin" ) */,
    },
    configure: {
        /* Any webpack configuration options: https://webpack.js.org/configuration */  
    }
},
plugins: [
    {
        plugin: CracoLessPlugin,
        options: {
          lessLoaderOptions: {
            lessOptions: {
              modifyVars: {
                "@primary-color": "#1DA57A",
                "@link-color": "#1DA57A",
                "@border-radius-base": "2px",
              },
              javascriptEnabled: true,
            },
          },
        },
      }
]
/*plugins: [
    {
        plugin: CracoAntDesignPlugin,
        options: {
            customizeThemeLessPath: path.join(
                __dirname,
                './src/antd.customize.less'
            ),
        },
    }
]*/
};
Clemios commented 2 years ago

Thank you @kamronbatman !

devuxer commented 2 years ago

@ndbroadbent, Perhaps you could you extend permissions to allow @kamronbatman to merge pull requests, as he seems to be making valuable contributions to maintaining this repo.

rkhaslarov commented 2 years ago

Pls merge it guys, really need it

folt commented 2 years ago

Looking forward to this merger. Can I offer help?  @kamronbatman

kamronbatman commented 2 years ago

Looking forward to this merger. Can I offer help?  @kamronbatman

I don't have access to merge. @ndbroadbent will need to do it. I just emailed him. Let's see.

ndbroadbent commented 2 years ago

Hi everyone, sorry for the delay, I've just merged this in. I just seem to be having some problems with yarn install at the moment, so I'm not able to release the new version to NPM:

$ yarn install
yarn install v1.22.17
[1/4] 🔍  Resolving packages...
warning Lockfile has incorrect entry for "jest@27.4.6". Ignoring it.
[2/4] 🚚  Fetching packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
error An unexpected error occurred: "http://artifactory.svc.bird.co/artifactory/api/npm/npm/webpack-dev-server/-/webpack-dev-server-4.7.2.tgz: ETIMEDOUT".
info If you think this is a bug, please open a bug report with the information provided in "/Users/ndbroadbent/code/craco-antd/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Will keep retrying and let you know once it's published.

kamronbatman commented 2 years ago

I'll be happy to do an audit and fix it. This was done in conjunction with Bird when I worked there. I'll fix it and push a new PR.

ndbroadbent commented 2 years ago

Ahh I see! Thanks!