Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

elonehoo/unplugin-vue-sfc-name

Repository files navigation

unplugin-vue-sfc-name

NPM version

Feature

  • support name
  • support inheritAttrs
  • precise breakpoints
  • Expanded the function of automatic name generation

Usage

Basic example

<template>
  <div>hello world {{ a }}</div>
</template>

<script lang="ts" setup name="App" inheritAttrs="false">
  const a = 1
</script>

Install

npm i unplugin-vue-sfc-name
Vite
// vite.config.ts
import Starter from 'unplugin-vue-sfc-name/vite'

export default defineConfig({
  plugins: [
    Starter({ /* options */ }),
  ],
})

Example: playground/


Rollup
// rollup.config.js
import Starter from 'unplugin-vue-sfc-name/rollup'

export default {
  plugins: [
    Starter({ /* options */ }),
  ],
}


Webpack
// webpack.config.js
module.exports = {
  /* ... */
  plugins: [
    require('unplugin-vue-sfc-name/webpack')({ /* options */ })
  ]
}


Nuxt
// nuxt.config.js
export default {
  buildModules: [
    ['unplugin-vue-sfc-name/nuxt', { /* options */ }],
  ],
}

This module works for both Nuxt 2 and Nuxt Vite

Vue CLI
// vue.config.js
module.exports = {
  configureWebpack: {
    plugins: [
      require('unplugin-vue-sfc-name/webpack')({ /* options */ }),
    ],
  },
}


esbuild
// esbuild.config.js
import { build } from 'esbuild'
import Starter from 'unplugin-vue-sfc-name/esbuild'

build({
  plugins: [Starter()],
})


About

Extending the vue script setup syntactic sugar

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published