feat: add unplugin-vue-components

This commit is contained in:
Nex Zhu 2021-12-27 19:23:47 +08:00
parent 545ef5b0dd
commit a9b2b816f8
No known key found for this signature in database
GPG Key ID: 15C6254AD19362B4
5 changed files with 82 additions and 2 deletions

10
.fes.js
View File

@ -2,6 +2,7 @@
import ESLintPlugin from 'eslint-webpack-plugin'
import StylelintPlugin from 'stylelint-webpack-plugin'
import AutoImportPlugin from 'unplugin-auto-import/webpack'
import VueComponentsPlugin from 'unplugin-vue-components/webpack'
export default {
publicPath: './',
@ -61,5 +62,14 @@ export default {
],
}),
)
config.plugin('vue-components').use(
VueComponentsPlugin({
dts: './src/types/components.d.ts',
include: [
/src\/.+\.vue$/,
/src\/.+\.vue\?vue/, // .vue
],
}),
)
},
}

1
.gitignore vendored
View File

@ -5,6 +5,7 @@
### Custom ###
src/.fes
src/.fes-production
### Node ###
# Logs

58
package-lock.json generated
View File

@ -35,7 +35,8 @@
"stylelint-config-recommended-vue": "^1.1.0",
"stylelint-webpack-plugin": "^3.1.0",
"typescript": "^4.5.4",
"unplugin-auto-import": "^0.5.5"
"unplugin-auto-import": "^0.5.5",
"unplugin-vue-components": "^0.17.11"
}
},
"node_modules/@ant-design/colors": {
@ -12861,6 +12862,43 @@
}
}
},
"node_modules/unplugin-vue-components": {
"version": "0.17.11",
"resolved": "https://registry.npmjs.org/unplugin-vue-components/-/unplugin-vue-components-0.17.11.tgz",
"integrity": "sha512-u5MQ0TbikszRelCt6EA/HskGtGkGLDxi7tQ4/4tcEPWkH3yXSZRJCOeLF5MSdxN1SiGjaJ0I9zeHjoZFC3FvRw==",
"dev": true,
"dependencies": {
"@antfu/utils": "^0.3.0",
"@rollup/pluginutils": "^4.1.1",
"chokidar": "^3.5.2",
"debug": "^4.3.2",
"fast-glob": "^3.2.7",
"local-pkg": "^0.4.0",
"magic-string": "^0.25.7",
"minimatch": "^3.0.4",
"resolve": "^1.20.0",
"unplugin": "^0.2.21"
},
"engines": {
"node": ">=14"
},
"funding": {
"url": "https://github.com/sponsors/antfu"
},
"peerDependencies": {
"@babel/parser": "^7.15.8",
"@babel/traverse": "^7.15.4",
"vue": "2 || 3"
},
"peerDependenciesMeta": {
"@babel/parser": {
"optional": true
},
"@babel/traverse": {
"optional": true
}
}
},
"node_modules/unset-value": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz",
@ -23426,6 +23464,24 @@
"unplugin": "^0.2.21"
}
},
"unplugin-vue-components": {
"version": "0.17.11",
"resolved": "https://registry.npmjs.org/unplugin-vue-components/-/unplugin-vue-components-0.17.11.tgz",
"integrity": "sha512-u5MQ0TbikszRelCt6EA/HskGtGkGLDxi7tQ4/4tcEPWkH3yXSZRJCOeLF5MSdxN1SiGjaJ0I9zeHjoZFC3FvRw==",
"dev": true,
"requires": {
"@antfu/utils": "^0.3.0",
"@rollup/pluginutils": "^4.1.1",
"chokidar": "^3.5.2",
"debug": "^4.3.2",
"fast-glob": "^3.2.7",
"local-pkg": "^0.4.0",
"magic-string": "^0.25.7",
"minimatch": "^3.0.4",
"resolve": "^1.20.0",
"unplugin": "^0.2.21"
}
},
"unset-value": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz",

View File

@ -55,7 +55,8 @@
"stylelint-config-recommended-vue": "^1.1.0",
"stylelint-webpack-plugin": "^3.1.0",
"typescript": "^4.5.4",
"unplugin-auto-import": "^0.5.5"
"unplugin-auto-import": "^0.5.5",
"unplugin-vue-components": "^0.17.11"
},
"dependencies": {
"@fesjs/fes": "^2.0.11",

12
src/types/components.d.ts vendored Normal file
View File

@ -0,0 +1,12 @@
// generated by unplugin-vue-components
// We suggest you to commit this file into source control
// Read more: https://github.com/vuejs/vue-next/pull/3399
declare module 'vue' {
export interface GlobalComponents {
PageLoading: typeof import('./../components/PageLoading.vue')['default']
UserCenter: typeof import('./../components/UserCenter.vue')['default']
}
}
export {}