From 5d4add1e9daf5f4bbb8482d1f453ad783ddea314 Mon Sep 17 00:00:00 2001 From: chuan_wuhao <443547225@qq.com> Date: Sun, 7 Aug 2022 17:41:19 +0800 Subject: [PATCH] update code --- vite-plugin/index.ts | 10 +++++----- vite.config.ts | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/vite-plugin/index.ts b/vite-plugin/index.ts index 2cb0665c..9a4d834c 100644 --- a/vite-plugin/index.ts +++ b/vite-plugin/index.ts @@ -7,9 +7,9 @@ import { createSvgIconsPlugin } from 'vite-plugin-svg-icons' // svg图标 import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite' // i18n import type { ComponentResolver, TypeImport } from 'unplugin-vue-components' -import type { VitePluginCompression, ViteBuildPlugin } from './type' +import type { VitePluginCompression } from './type' import type { ImportsMap, PresetName } from 'unplugin-auto-import/types' -import type { ServerOptions } from 'vite' +import type { ServerOptions, BuildOptions } from 'vite' /** * @@ -148,11 +148,11 @@ export const useHTMLTitlePlugin = (title = 'ray template') => { * * @param options 自定义打包配置参数 */ -export const useViteBuildPlugin = (options?: ViteBuildPlugin) => { - const defaultPlugin = { +export const useViteBuildPlugin = (options?: BuildOptions) => { + const defaultPlugin: BuildOptions = { outDir: 'dist', // 打包后文件输出路径 assetsDir: 'assets', // 指定静态资源存放路径 - assetsInlineLimit: 2048, + assetsInlineLimit: 4096, cssCodeSplit: true, // 拆分css代码 minify: 'esbuild', // 指定使用混淆器(terser|esbuild) sourcemap: false, diff --git a/vite.config.ts b/vite.config.ts index 87312a15..64ed481e 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -35,7 +35,7 @@ export default defineConfig(async () => { useCreateSvgIconsPlugin(), ], optimizeDeps: { - // include: ['vue', 'vue-router', 'pinia', 'vue-i18n'], + include: ['vue', 'vue-router', 'pinia', 'vue-i18n', '@vueuse/core'], }, build: { ...useViteBuildPlugin(),