Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Place vite file outside folder #524

Open
5 tasks done
laudaikinhdi opened this issue Aug 28, 2024 · 1 comment
Open
5 tasks done

Place vite file outside folder #524

laudaikinhdi opened this issue Aug 28, 2024 · 1 comment

Comments

@laudaikinhdi
Copy link

laudaikinhdi commented Aug 28, 2024

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.
@laudaikinhdi
Copy link
Author

Help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant