引入 vite-plugin-vue-setup-extend 依赖,优化 plop 模版

This commit is contained in:
hooray 2021-09-29 02:30:29 +08:00
parent b6f7cbd156
commit 19a44d8a7b
5 changed files with 74 additions and 9 deletions

View File

@ -56,6 +56,7 @@
"vite-plugin-restart": "^0.0.2",
"vite-plugin-spritesmith": "^0.1.1",
"vite-plugin-svg-icons": "^1.0.4",
"vite-plugin-vue-setup-extend": "^0.1.0",
"vue-eslint-parser": "^7.11.0"
}
}

View File

@ -7,15 +7,11 @@
</div>
</template>
<script>
export default {
name: '{{ properCase componentName }}',
data() {
return {}
},
mounted() {},
methods: {}
}
<script setup name="{{ properCase componentName }}">
// const { proxy } = getCurrentInstance()
// const router = useRouter()
// const route = useRoute()
// const store = useStore()
</script>
<style lang="scss" scoped>

View File

@ -38,6 +38,7 @@ specifiers:
vite-plugin-restart: ^0.0.2
vite-plugin-spritesmith: ^0.1.1
vite-plugin-svg-icons: ^1.0.4
vite-plugin-vue-setup-extend: ^0.1.0
vue: ^3.2.18
vue-eslint-parser: ^7.11.0
vue-router: ^4.0.11
@ -86,6 +87,7 @@ devDependencies:
vite-plugin-restart: registry.nlark.com/vite-plugin-restart/0.0.2_vite@2.5.10
vite-plugin-spritesmith: registry.nlark.com/vite-plugin-spritesmith/0.1.1
vite-plugin-svg-icons: registry.nlark.com/vite-plugin-svg-icons/1.0.4_vite@2.5.10
vite-plugin-vue-setup-extend: registry.npmmirror.com/vite-plugin-vue-setup-extend/0.1.0_vite@2.5.10
vue-eslint-parser: registry.nlark.com/vue-eslint-parser/7.11.0_eslint@7.32.0
packages:
@ -208,6 +210,8 @@ packages:
json5: registry.nlark.com/json5/2.2.0
semver: registry.nlark.com/semver/6.3.0
source-map: registry.nlark.com/source-map/0.5.7
transitivePeerDependencies:
- supports-color
dev: true
registry.nlark.com/@babel/generator/7.15.4:
@ -548,6 +552,8 @@ packages:
'@babel/core': registry.nlark.com/@babel/core/7.15.5
postcss: registry.nlark.com/postcss/7.0.36
postcss-syntax: registry.nlark.com/postcss-syntax/0.36.2_postcss@7.0.36
transitivePeerDependencies:
- supports-color
dev: true
registry.nlark.com/@stylelint/postcss-markdown/0.36.2_2b33a41d320e3e2012e5b3b0fadc703b:
@ -719,6 +725,11 @@ packages:
peerDependencies:
'@vue/composition-api': ^1.1.0
vue: ^2.6.0 || ^3.2.0
peerDependenciesMeta:
'@vue/composition-api':
optional: true
vue:
optional: true
dependencies:
'@vueuse/shared': registry.nlark.com/@vueuse/shared/6.1.0_vue@3.2.18
vue: registry.npmmirror.com/vue/3.2.18
@ -733,6 +744,11 @@ packages:
peerDependencies:
'@vue/composition-api': ^1.1.0
vue: ^2.6.0 || ^3.2.0
peerDependenciesMeta:
'@vue/composition-api':
optional: true
vue:
optional: true
dependencies:
vue: registry.npmmirror.com/vue/3.2.18
vue-demi: registry.nlark.com/vue-demi/0.11.4_vue@3.2.18
@ -1730,6 +1746,11 @@ packages:
name: debug
version: 4.3.2
engines: {node: '>=6.0'}
peerDependencies:
supports-color: '*'
peerDependenciesMeta:
supports-color:
optional: true
dependencies:
ms: registry.nlark.com/ms/2.1.2
dev: true
@ -2061,6 +2082,8 @@ packages:
natural-compare: registry.nlark.com/natural-compare/1.4.0
semver: registry.nlark.com/semver/6.3.0
vue-eslint-parser: registry.nlark.com/vue-eslint-parser/7.11.0_eslint@7.32.0
transitivePeerDependencies:
- supports-color
dev: true
registry.nlark.com/eslint-scope/5.1.1:
@ -3781,6 +3804,8 @@ packages:
please-upgrade-node: registry.nlark.com/please-upgrade-node/3.2.0
string-argv: 0.3.1
stringify-object: registry.nlark.com/stringify-object/3.3.0
transitivePeerDependencies:
- supports-color
dev: true
registry.nlark.com/loader-utils/1.4.0:
@ -6022,6 +6047,8 @@ packages:
table: registry.nlark.com/table/6.7.1
v8-compile-cache: registry.nlark.com/v8-compile-cache/2.3.0
write-file-atomic: registry.nlark.com/write-file-atomic/3.0.3
transitivePeerDependencies:
- supports-color
dev: true
registry.nlark.com/sugarss/2.0.0:
@ -6436,6 +6463,9 @@ packages:
engines: {node: '>=14'}
peerDependencies:
'@vueuse/core': ^6.0.0
peerDependenciesMeta:
'@vueuse/core':
optional: true
dependencies:
'@antfu/utils': registry.nlark.com/@antfu/utils/0.3.0
'@rollup/pluginutils': registry.nlark.com/@rollup/pluginutils/4.1.1
@ -6615,6 +6645,8 @@ packages:
debug: registry.nlark.com/debug/4.3.2
fs-extra: registry.nlark.com/fs-extra/10.0.0
vite: registry.npmmirror.com/vite/2.5.10
transitivePeerDependencies:
- supports-color
dev: true
registry.nlark.com/vite-plugin-html/2.1.0_vite@2.5.10:
@ -6657,6 +6689,7 @@ packages:
vite: registry.npmmirror.com/vite/2.5.10
transitivePeerDependencies:
- rollup
- supports-color
dev: true
registry.nlark.com/vite-plugin-restart/0.0.2_vite@2.5.10:
@ -6701,6 +6734,8 @@ packages:
svg-baker: 1.7.0
svgo: registry.npmmirror.com/svgo/2.7.0
vite: registry.npmmirror.com/vite/2.5.10
transitivePeerDependencies:
- supports-color
dev: true
registry.nlark.com/vue-demi/0.11.4_vue@3.2.18:
@ -6714,6 +6749,9 @@ packages:
peerDependencies:
'@vue/composition-api': ^1.0.0-rc.1
vue: ^3.0.0-0 || ^2.6.0
peerDependenciesMeta:
'@vue/composition-api':
optional: true
dependencies:
vue: registry.npmmirror.com/vue/3.2.18
dev: false
@ -6735,6 +6773,8 @@ packages:
esquery: registry.nlark.com/esquery/1.4.0
lodash: registry.nlark.com/lodash/4.17.21
semver: registry.nlark.com/semver/6.3.0
transitivePeerDependencies:
- supports-color
dev: true
registry.nlark.com/vue-router/4.0.11_vue@3.2.18:
@ -7301,6 +7341,7 @@ packages:
vue: registry.npmmirror.com/vue/3.2.18
transitivePeerDependencies:
- rollup
- supports-color
- vite
- webpack
dev: true
@ -7314,12 +7355,32 @@ packages:
rollup: ^2.50.0
vite: ^2.3.0
webpack: 4 || 5
peerDependenciesMeta:
rollup:
optional: true
vite:
optional: true
webpack:
optional: true
dependencies:
pathe: registry.npmmirror.com/pathe/0.0.2
vite: registry.npmmirror.com/vite/2.5.10
webpack-virtual-modules: registry.nlark.com/webpack-virtual-modules/0.4.3
dev: true
registry.npmmirror.com/vite-plugin-vue-setup-extend/0.1.0_vite@2.5.10:
resolution: {integrity: sha1-nwjvu8Ku0QP1SbNpbe5dRi2yPzg=, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/vite-plugin-vue-setup-extend/download/vite-plugin-vue-setup-extend-0.1.0.tgz}
id: registry.npmmirror.com/vite-plugin-vue-setup-extend/0.1.0
name: vite-plugin-vue-setup-extend
version: 0.1.0
peerDependencies:
vite: '>=2.0.0'
dependencies:
'@vue/compiler-sfc': registry.npmmirror.com/@vue/compiler-sfc/3.2.18
magic-string: registry.nlark.com/magic-string/0.25.7
vite: registry.npmmirror.com/vite/2.5.10
dev: true
registry.npmmirror.com/vite/2.5.10:
resolution: {integrity: sha1-xZjjtafhlW/8Uus7NCDRd/wu0qU=, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/vite/download/vite-2.5.10.tgz}
name: vite

View File

@ -4,6 +4,7 @@ import createRestart from './restart'
import createHtml from './html'
import createAutoImport from './auto-import'
import createComponents from './components'
import createSetupExtend from './setup-extend'
import createSvgIcon from './svg-icon'
import createMock from './mock'
import createCompression from './compression'
@ -16,6 +17,7 @@ export default function createVitePlugins(viteEnv, isBuild = false) {
vitePlugins.push(createHtml(viteEnv, isBuild))
vitePlugins.push(createAutoImport())
vitePlugins.push(createComponents())
vitePlugins.push(createSetupExtend())
vitePlugins.push(createSvgIcon(isBuild))
vitePlugins.push(createMock())
isBuild && vitePlugins.push(...createCompression(viteEnv))

View File

@ -0,0 +1,5 @@
import setupExtend from 'vite-plugin-vue-setup-extend'
export default function createSetupExtend() {
return setupExtend()
}