0.0.3 • Published 1 year ago
vite-plugin-vue-component-name v0.0.3
vite-plugin-vue-component-name
Features
- Make the vue script syntax support the name attribute
- Make the vue script setup syntax support the name attribute
- Allow the vue script syntax with empty content support the name attribute
- Use file path generate name attribute
Install
node version: >=12.0.0 vite version: >=2.0.0
pnpm i vite-plugin-vue-component-name -D
or
npm i vite-plugin-vue-component-name -D
or
yarn add vite-plugin-vue-component-name -D
Usage
- Config plugin in vite.config.ts. In this way, the required functions can be introduced as needed
import { Plugin, defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueComponentName from 'vite-plugin-vue-component-name'
export default defineConfig({
plugins: [vue(), vueComponentName()],
})
- SFC
<script lang="ts" setup name="App"></script>
<template>
<div>hello world</div>
</template>