npm i unplugin-react-components -D Vite // vite.config.tsimportComponentsfrom'unplugin-react-components/vite'exportdefaultdefineConfig({plugins:[React(),Components({/* options */}),],}) Webpack // webpack.config.jsmodule.exports={/* ... */plugins:[require('unplugin-react-components/web...
unplugin-react-componentsInstallnpm i unplugin-react-components -DVite // vite.config.ts import Components from 'unplugin-react-components/vite' export default defineConfig({ plugins: [ React(), Components({ /* options */ }), ], })
import{createResolver}from'unplugin-react-components'Components({resolvers:[createResolver({module:'react-ui',prefix:'RUi',exclude:(name)=>{returnname.startsWith('Excluded')},})]}) sideEffects Assume you are using antd exportdefaultfunctionApp(){return(<Button/>)} ...