unplugin-icons: There are tsx and vue files in the project, can't both files be automatically imported?

In the .vue file, it works fine

// vite.config.ts
IconsResolver({
  enabledCollections: ['ep']
})

But in tsx, I tried to write like this, but it didn’t work😢

// vite.config.ts
plugins: [
  Icons({
    jsx: 'react', // 'react' or 'preact'
    compiler: 'jsx', // 'vue2', 'vue3', 'jsx'
  }),
  // Api自动导入
  AutoImport({
    resolvers: [
      IconsResolver({
        prefix: 'i', // 图标前缀,默认为i
        enabledCollections: ['ep'],
        extension: 'jsx',
      }),
    ],
  }),
  // 按需导入组件
  Components({
    resolvers: [
      // 自动注册图标组件
      IconsResolver({
        prefix: 'i', // 图标前缀,默认为i
        extension: 'jsx',
        enabledCollections: ['ep'],
      }),
    ],
  }),
],

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 21 (12 by maintainers)

Most upvoted comments

@userquin OK, thank you very much!👍🥰

@userquin thank you, my friend. However, you need to wait for a while, I will provide you with it when I get home from getting off work later~ 😂

about an hour later…