Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

fix(schema): add typings for vite.vue options #6220

Merged
merged 3 commits into from
Jul 29, 2022
Merged

Conversation

danielroe
Copy link
Member

πŸ”— Linked issue

resolves nuxt/nuxt#14452

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This adds typings for vite.vue to the schema.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@danielroe danielroe added bug Something isn't working types schema labels Jul 29, 2022
@danielroe danielroe requested a review from antfu July 29, 2022 08:55
@danielroe danielroe self-assigned this Jul 29, 2022
@netlify
Copy link

netlify bot commented Jul 29, 2022

βœ… Deploy Preview for nuxt3-docs ready!

Name Link
πŸ”¨ Latest commit 9a9e63c
πŸ” Latest deploy log https://app.netlify.com/sites/nuxt3-docs/deploys/62e3b1340f3635000873d1a3
😎 Deploy Preview https://deploy-preview-6220--nuxt3-docs.netlify.app
πŸ“± Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@antfu
Copy link
Member

antfu commented Jul 29, 2022

I have tried to do this, but it seems ViteConfig does not been copied over to the generated .d.ts

export interface ViteConfig extends UserConfig {
  /**
   * Options passed to @vitejs/plugin-vue
   * @see https://github.com/vitejs/vite/tree/main/packages/plugin-vue
   */
  vue?: VuePluginOptions
  /**
   * Bundler for dev time server-side rendering.
   * @default 'vite-node'
   */
  serverBundler?: 'vite-node' | 'legacy'
}

export default {
  /**
   * Configuration that will be passed directly to Vite.
   *
   * See https://vitejs.dev/config for more information.
   * Please note that not all vite options are supported in Nuxt.
   *
   * @type {ViteConfig}
   * @version 3
   */

@danielroe
Copy link
Member Author

danielroe commented Jul 29, 2022

You can currently use @typedef inline within that file, or use a pattern like this:

* @type {typeof import('../src/types/meta').MetaObject}

(Feel free to push improvements to this branch @antfu.)

@danielroe danielroe merged commit 968087b into main Jul 29, 2022
@danielroe danielroe deleted the fix/vite-vue-types branch July 29, 2022 10:57
@@ -1,5 +1,7 @@
import { ConfigSchema } from '../../schema/config'
import type { ResolvedConfig } from 'c12'
import { UserConfig } from 'vite'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could rename this import with vite in it and use import type

This was referenced Jul 29, 2022
@danielroe danielroe added the 3.x label Jan 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
3.x bug Something isn't working schema types
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing types for vite.vue
4 participants