- support name
- support inheritAttrs
- precise breakpoints
- Expanded the function of automatic name generation
<template>
<div>hello world {{ a }}</div>
</template>
<script lang="ts" setup name="App" inheritAttrs="false">
const a = 1
</script>
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()],
})