mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-14 18:13:54 +00:00
19 lines
523 B
TypeScript
19 lines
523 B
TypeScript
|
import { createRequire } from 'module'
|
||
|
import { addVitePlugin, addWebpackPlugin, useNuxt } from '@nuxt/kit'
|
||
|
|
||
|
const _require = createRequire(import.meta.url)
|
||
|
const scriptSetupPlugin = _require('unplugin-vue2-script-setup').default
|
||
|
|
||
|
export const setupScriptSetup = () => {
|
||
|
const nuxt = useNuxt()
|
||
|
|
||
|
addVitePlugin(scriptSetupPlugin.vite())
|
||
|
addWebpackPlugin(scriptSetupPlugin.webpack())
|
||
|
|
||
|
nuxt.hook('prepare:types', ({ references }) => {
|
||
|
references.push({
|
||
|
types: 'unplugin-vue2-script-setup/types'
|
||
|
})
|
||
|
})
|
||
|
}
|