wuzekang / antd-theme

Provide runtime dynamic theme for ant design.
https://wuzekang.github.io/antd-theme
54 stars 14 forks source link

using craco with antd-theme #7

Open realjesset opened 4 years ago

realjesset commented 4 years ago

I use craco to use antd, and I am issues using this plugin. I keep getting a could not find a declaration file for module './runtime' in 'antd-theme/lib/index.tsx(8,8)'.

here's my craco config file:

const CracoLessPlugin = require("craco-less");
const {
    getThemeVariables
} = require('antd/dist/theme');
const AntdThemePlugin = require('antd-theme/plugin');

module.exports = {
    plugins: [{
        plugin: CracoLessPlugin,
        options: {
            lessLoaderOptions: {
                lessOptions: {
                    modifyVars: {
                        "@primary-color": "#1DA57A",
                        // ...getThemeVariables({
                        //     dark: true,
                        //     compact: true
                        // })
                    },
                    javascriptEnabled: true
                }
            }
        }
    }],
    webpack: {
        plugins: [new AntdThemePlugin({
            // Variables declared here can be modified at runtime
            variables: ['primary-color'],
            themes: [{
                    name: 'dark',
                    filename: require.resolve('antd/lib/style/themes/dark.less'),
                },
                {
                    name: 'compact',
                    filename: require.resolve('antd/lib/style/themes/compact.less'),
                },
            ],
        })]
    }
};
rafaelncarvalho commented 3 years ago

Any news about this?