This package, `vite-plugin-vue-setup-extend`, enhances the `<script setup>` syntactic sugar in Vue Single File Components (SFCs). Its primary function is to allow developers to define additional attributes directly on the `<script setup>` tag, such as `name` and `inheritAttrs`, which are typically unavailable in the standard `<script setup>` syntax. This capability is particularly useful for debugging with Vue DevTools, enabling recursive components, or explicitly setting component names for clearer component hierarchies. The current stable version is 0.4.0, but it was last published over four years ago (January 2022). Due to its lack of recent updates, it is considered abandoned and may not be compatible with newer versions of Vue or Vite, which have undergone significant changes since its last release. Users should proceed with caution and be prepared for potential compatibility issues with modern tooling.
npm install vite-plugin-vue-setup-extendVerified import paths — ran on the pinned version, not inferred.
This configuration demonstrates how to integrate `vite-plugin-vue-setup-extend` into your `vite.config.ts` file. It ensures that the plugin is activated alongside the official `@vitejs/plugin-vue` to extend `<script setup>` syntax capabilities.
Consider migrating to alternatives like `unplugin-vue-macros` or manually defining component options if you encounter issues. For new projects, avoid this plugin.
Always add `vueSetupExtend()` after `vue()` in the `plugins` array within `vite.config.ts`.
Ensure your Vite config uses ES module syntax (`import/export`) or rename your config file to `.mjs`/`.mts` if necessary. If facing `ERR_REQUIRE_ESM`, refactor to `import` statements.
Change `const vueSetupExtend = require('vite-plugin-vue-setup-extend')` to `import vueSetupExtend from 'vite-plugin-vue-setup-extend'`.Verify the plugin's compatibility with your current Vite and Vue versions. If using an older plugin like `vite-plugin-vue-setup-extend`, consider if it's causing conflicts and disabling it or searching for a maintained alternative. Clear your Node modules and `node_modules/.vite` cache.