generated from thzxcx/vue3
build: 开发依赖
This commit is contained in:
100
vite.config.ts
100
vite.config.ts
@ -2,8 +2,8 @@
|
||||
* @Author: zhaojinfeng 121016171@qq.com
|
||||
* @Date: 2023-06-15 13:22:04
|
||||
* @LastEditors: zhaojinfeng 121016171@qq.com
|
||||
* @LastEditTime: 2023-06-21 11:32:48
|
||||
* @FilePath: \vue3\vite.config.ts
|
||||
* @LastEditTime: 2023-06-21 17:36:45
|
||||
* @FilePath: \uni\vite.config.ts
|
||||
* @Description:
|
||||
*
|
||||
*/
|
||||
@ -16,7 +16,18 @@ import AutoImport from 'unplugin-auto-import/vite'
|
||||
import eslint from 'vite-plugin-eslint'
|
||||
import Components from 'unplugin-vue-components/vite'
|
||||
import setupExtend from 'vite-plugin-vue-setup-extend'
|
||||
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
||||
|
||||
const reg = /[A-Z]/
|
||||
function toLower(name: string) {
|
||||
let lower = ''
|
||||
for (let i = 0; i <= name.length - 1; i++) {
|
||||
if (reg.test(name[i]))
|
||||
lower += `-${name[i].toLowerCase()}`
|
||||
else
|
||||
lower += name[i]
|
||||
}
|
||||
return lower
|
||||
}
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
|
||||
@ -42,18 +53,15 @@ export default defineConfig({
|
||||
vueJsx(),
|
||||
libCss({}),
|
||||
AutoImport({
|
||||
resolvers: [
|
||||
ElementPlusResolver(),
|
||||
],
|
||||
dts: 'types/auto-imports.d.ts',
|
||||
imports: [
|
||||
'vue',
|
||||
'vue/macros',
|
||||
'vue-router',
|
||||
'uni-app',
|
||||
'@vueuse/core',
|
||||
{
|
||||
'vue': ['createVNode'],
|
||||
'element-plus': ['dayjs'],
|
||||
vue: ['createVNode'],
|
||||
},
|
||||
],
|
||||
vueTemplate: true,
|
||||
@ -66,11 +74,85 @@ export default defineConfig({
|
||||
from: 'vue-router',
|
||||
names: ['RouterLink', 'RouterView'],
|
||||
},
|
||||
{
|
||||
from: '@uni-helper/uni-ui-types',
|
||||
names: [
|
||||
'UniBadge',
|
||||
'UniBreadcrumb',
|
||||
'UniBreadcrumbItem',
|
||||
'UniCalendar',
|
||||
'UniCard',
|
||||
'UniCol',
|
||||
'UniCollapse',
|
||||
'UniCollapseItem',
|
||||
'UniCombox',
|
||||
'UniCountdown',
|
||||
'UniDataCheckbox',
|
||||
'UniDataPicker',
|
||||
'UniDataSelect',
|
||||
'UniDateformat',
|
||||
'UniDatetimePicker',
|
||||
'UniDrawer',
|
||||
'UniEasyinput',
|
||||
'UniFab',
|
||||
'UniFav',
|
||||
'UniFilePicker',
|
||||
'UniForms',
|
||||
'UniFormsItem',
|
||||
'UniGoodsNav',
|
||||
'UniGrid',
|
||||
'UniGridItem',
|
||||
'UniGroup',
|
||||
'UniIcons',
|
||||
'UniIndexedList',
|
||||
'UniLink',
|
||||
'UniList',
|
||||
'UniListAd',
|
||||
'UniListChat',
|
||||
'UniListItem',
|
||||
'UniLoadMore',
|
||||
'UniNavBar',
|
||||
'UniNoticeBar',
|
||||
'UniNumberBox',
|
||||
'UniPagination',
|
||||
'UniPopup',
|
||||
'UniPopupDialog',
|
||||
'UniPopupMessage',
|
||||
'UniPopupShare',
|
||||
'UniRate',
|
||||
'UniRow',
|
||||
'UniSearchBar',
|
||||
'UniSection',
|
||||
'UniSegmentedControl',
|
||||
'UniSteps',
|
||||
'UniSwipeAction',
|
||||
'UniSwipeActionItem',
|
||||
'UniSwiperDot',
|
||||
'UniTable',
|
||||
'UniTag',
|
||||
'UniTd',
|
||||
'UniTh',
|
||||
'UniTitle',
|
||||
'UniTooltip',
|
||||
'UniTr',
|
||||
'UniTransition',
|
||||
],
|
||||
},
|
||||
],
|
||||
directoryAsNamespace: true,
|
||||
resolvers: [
|
||||
ElementPlusResolver(),
|
||||
function (name) {
|
||||
if (name.startsWith('Uni')) {
|
||||
const componentName = toLower(name.slice(3))
|
||||
return {
|
||||
name: 'default',
|
||||
as: name,
|
||||
from: `@dcloudio/uni-ui/lib/uni${componentName}/uni${componentName}.vue`,
|
||||
}
|
||||
}
|
||||
},
|
||||
],
|
||||
|
||||
}),
|
||||
setupExtend(),
|
||||
eslint(),
|
||||
|
Reference in New Issue
Block a user