arco-design / arco-design-vue

A Vue.js 3 UI Library based on Arco Design
https://arco.design/vue
MIT License
2.73k stars 536 forks source link

组件按需引入无效!!! #1891

Closed popdo closed 1 year ago

popdo commented 1 year ago

Basic Info

Steps to reproduce

按照官方文档的 “按需加载(模板)” 的方法配置后。没用到的组件css样式一样被引入进去。最后npm build出来的css也是全部组件的样式代码。

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite';
import { ArcoResolver } from 'unplugin-vue-components/resolvers';

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    AutoImport({
      resolvers: [ArcoResolver()],
    }),
    Components({
      resolvers: [
        ArcoResolver({
          sideEffect: true
        })
      ]
    })
  ]
});

是我哪里没有配置对吗?

tazyong commented 1 year ago

使用 @arco-plugins/vite-vue 官方插件来处理按需要导入,如果问题已解决请关闭 issue 吧