Expansion based on vite-plugin-vue-setup-extend
Make the vue script setup syntax support the name attribute and fix source-map bug for debug
node version: >=14.18.0
yarn add vite-plugin-vue-setup-name -D
or
npm i vite-plugin-vue-setup-name -D
- Config plugin in vite.config.ts. In this way, the required functions can be introduced as needed
import { defineConfig, Plugin } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueSetupExtend from 'vite-plugin-vue-setup-extend-plus'
export default defineConfig({
plugins: [vue(), vueSetupExtend()],
})
- SFC
<template>
<div>hello world {{ a }}</div>
</template>
<script lang="ts" setup name="App">
// need one line comment or code at least
</script>
MIT