unplugin/unplugin-auto-import

Place vite file outside folder

laudaikinhdi opened this issue · 1 comments

Describe the bug

  1. I have the structure
  • api
    • vite.cms.config.mts
  • cms (vite + vue 3)
  1. I use the laravel-vite-plugin and place vite.cms.config.mts inside the api folder (Laravel).
  2. Problem:
    • When I create a new file, AutoImport and Components do not automatically update the file.d.ts.
    • This issue only occurs when the configuration file is placed outside the cms folder.
vite.cms.config.mts
export default defineConfig({
  plugins: [
    laravel({
      input: [resolve(__dirname, '../cms/src/main.ts')],
      buildDirectory: 'build/cms',
    }),
    tsconfigPaths({ loose: true }),
    AutoImport({
      resolvers: [
        ElementPlusResolver(),
      ],
      imports: [
        'vue',
      ],
      dirs: [
        resolve(__dirname, '../cms/src/uses/**'),
        resolve(__dirname, '../cms/src/api'),
      ],
      dts: resolve(__dirname, '../cms/auto-imports.d.ts'),
      vueTemplate: true,
      viteOptimizeDeps: true,
    }),
    Components({
      extensions: ['vue', 'tsx'],
      resolvers: [
        ElementPlusResolver({
          importStyle: 'sass',
        }),
      ],
      dirs: [resolve(__dirname, '../cms/src/components')],
      globs: [
        resolve(__dirname, '../cms/src/components/**/*.vue'),
      ],
      include: [/\.vue$/, /\.vue\?vue/, /\.tsx?$/],
      dts: resolve(__dirname, '../cms/components.d.ts')
    }),
  ],
});

Reproduction

Place vite.config.ts outside root folder

System Info

None

Used Package Manager

yarn

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.