mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-15 02:14:44 +00:00
ac98373b4c
Co-authored-by: pooya parsa <pyapar@gmail.com>
18 lines
560 B
TypeScript
18 lines
560 B
TypeScript
import { addVitePlugin, addWebpackPlugin, useNuxt } from '@nuxt/kit'
|
|
import scriptSetupPlugin from 'unplugin-vue2-script-setup'
|
|
import type { ScriptSetupOptions } from '../types'
|
|
|
|
export const setupScriptSetup = (options: ScriptSetupOptions) => {
|
|
const nuxt = useNuxt()
|
|
const config = options === true ? {} : options
|
|
|
|
addVitePlugin(scriptSetupPlugin.vite(config))
|
|
addWebpackPlugin(scriptSetupPlugin.webpack(config))
|
|
|
|
nuxt.hook('prepare:types', ({ references }) => {
|
|
references.push({
|
|
types: 'unplugin-vue2-script-setup/types'
|
|
})
|
|
})
|
|
}
|