Skip to content

How to auto import naive ui vue component and styles in tsx or jsx #825

Open
@maxfrees

Description

@maxfrees

Describe the bug

Describe the bug

How to auto import ant design vue component and styles in tsx or jsx

I have imported NaiveUiResolver in two plug-ins, but there is no way to import naiveui components automatically in jsx.

Image

import path from 'node:path';
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers';
import Components from 'unplugin-vue-components/vite';

export default Components({
  dirs: ['src/components'],
  include: [/\.vue$/, /\.vue\?vue/],
  dts: path.resolve(process.cwd(), 'components.d.ts'),
  extensions: ['vue'],
  resolvers: [NaiveUiResolver()]
});
import path from 'node:path';
import AutoImport from 'unplugin-auto-import/vite';
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers';

export default AutoImport({
  dts: path.resolve(process.cwd(), 'auto-imports.d.ts'),
  include: [/\.[tj]sx?$/, /\.vue$/, /\.vue\?vue/, /\.md$/],
  imports: [
    'vue',
    'vue-router',
    'vue-i18n',
    'pinia',
   
  ],
  dirs: [
    'src/constants',

  ],
  vueTemplate: true,
  eslintrc: {
    enabled: true,
    filepath: path.resolve(process.cwd(), '.eslintrc-auto-import.json')
  },
  resolvers: [NaiveUiResolver()]
});

Reproduction

System Info

-

Used Package Manager

npm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Reproduction

System Info

-

Used Package Manager

npm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy