Vue 3 `<script setup>` Name & Attrs Extension

0.1.0 · deprecated · verified Wed Apr 22

vite-plugin-vue-setup-extend-plus is a Vite plugin designed to enhance the Vue 3 `<script setup>` syntactic sugar within Single File Components (SFCs). It specifically introduces support for defining the `name` and `inheritAttrs` attributes directly on the `<script setup>` tag, a capability not natively available in Vue 3's initial `<script setup>` implementation. This allows for easier component introspection and finer control over attribute inheritance for components utilizing the composition API. The package is currently at version 0.1.0 and appears to have had a single release. It builds upon `vite-plugin-vue-setup-extend` but explicitly indicates that "iterative updates are made in unplugin-vue-setup-extend-plus during the later period," suggesting it has been superseded by its `unplugin` counterpart for ongoing development and maintenance. Its primary function is a targeted code transformation during the Vite build process to enable these additional attributes.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to configure `vite-plugin-vue-setup-extend-plus` in your `vite.config.ts` and then apply the `name` and `inheritAttrs` attributes directly to a `<script setup>` block in a Vue SFC.

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueSetupExtend from 'vite-plugin-vue-setup-extend-plus'

export default defineConfig({
  plugins: [
    vue(), 
    vueSetupExtend()
  ],
})

// In your Vue SFC (e.g., src/App.vue):
// <template>
//   <div>hello world {{ message }}</div>
// </template>

// <script lang="ts" setup name="App" inheritAttrs="false">
//   const message = 'from App component'
// </script>

view raw JSON →