mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-14 18:13:54 +00:00
17 lines
500 B
TypeScript
17 lines
500 B
TypeScript
import { useNuxt, installModule } from '@nuxt/kit'
|
|
import scriptSetupPlugin from 'unplugin-vue2-script-setup/nuxt'
|
|
import type { ScriptSetupOptions } from '../types'
|
|
|
|
export const setupScriptSetup = async (options: ScriptSetupOptions) => {
|
|
const nuxt = useNuxt()
|
|
const config = options === true ? {} : options
|
|
|
|
nuxt.hook('prepare:types', ({ references }) => {
|
|
references.push({
|
|
types: 'unplugin-vue2-script-setup/types'
|
|
})
|
|
})
|
|
|
|
await installModule(scriptSetupPlugin, config)
|
|
}
|