Skip to content

tttxdxd/vite-plugin-vue-component-name

Repository files navigation

vite-plugin-vue-component-name

NPM version

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>

Thanks

License

MIT License © 2023 tttxdxd

About

Make the vue script syntax support the name attribute

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published