update code

This commit is contained in:
chuan_wuhao 2022-08-07 17:41:19 +08:00
parent c729ec3117
commit 5d4add1e9d
2 changed files with 6 additions and 6 deletions

View File

@ -7,9 +7,9 @@ import { createSvgIconsPlugin } from 'vite-plugin-svg-icons' // svg图标
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite' // i18n import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite' // i18n
import type { ComponentResolver, TypeImport } from 'unplugin-vue-components' 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 { 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 * @param options
*/ */
export const useViteBuildPlugin = (options?: ViteBuildPlugin) => { export const useViteBuildPlugin = (options?: BuildOptions) => {
const defaultPlugin = { const defaultPlugin: BuildOptions = {
outDir: 'dist', // 打包后文件输出路径 outDir: 'dist', // 打包后文件输出路径
assetsDir: 'assets', // 指定静态资源存放路径 assetsDir: 'assets', // 指定静态资源存放路径
assetsInlineLimit: 2048, assetsInlineLimit: 4096,
cssCodeSplit: true, // 拆分css代码 cssCodeSplit: true, // 拆分css代码
minify: 'esbuild', // 指定使用混淆器(terser|esbuild) minify: 'esbuild', // 指定使用混淆器(terser|esbuild)
sourcemap: false, sourcemap: false,

View File

@ -35,7 +35,7 @@ export default defineConfig(async () => {
useCreateSvgIconsPlugin(), useCreateSvgIconsPlugin(),
], ],
optimizeDeps: { optimizeDeps: {
// include: ['vue', 'vue-router', 'pinia', 'vue-i18n'], include: ['vue', 'vue-router', 'pinia', 'vue-i18n', '@vueuse/core'],
}, },
build: { build: {
...useViteBuildPlugin(), ...useViteBuildPlugin(),