Fetch the repository succeeded.
This action will force synchronization from hu-snail/vue3-admin-element-template, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
import { defineConfig } from 'vite';
const path = require('path');
import vue from '@vitejs/plugin-vue';
import legacy from '@vitejs/plugin-legacy';
import { viteMockServe } from 'vite-plugin-mock';
import { setting } from './src/config/setting';
import { svgBuilder } from './src/plugin/svgBuilder';
import OptimizationPersist from 'vite-plugin-optimize-persist';
import PkgConfig from 'vite-plugin-package-config';
import vueI18n from '@intlify/vite-plugin-vue-i18n';
import AutoImport from 'unplugin-auto-import/vite';
import Components from 'unplugin-vue-components/vite';
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers';
import Icons from 'unplugin-icons/vite';
import IconsResolver from 'unplugin-icons/resolver';
const {
base,
publicDir,
outDir,
assetsDir,
sourcemap,
cssCodeSplit,
host,
port,
strictPort,
open,
cors,
brotliSize,
logLevel,
clearScreen,
drop_console,
drop_debugger,
chunkSizeWarningLimit,
} = setting;
const isDev = process.env.NODE_ENV === 'development';
const loadI18n = isDev ? vueI18n({ include: path.resolve(__dirname, './src/locales/**') }) : '';
// https://vitejs.dev/config/
export default defineConfig({
root: process.cwd(),
base,
publicDir,
logLevel,
clearScreen,
plugins: [
vue(),
PkgConfig(),
OptimizationPersist(),
loadI18n,
legacy({
polyfills: ['es.promise.finally', 'es/map', 'es/set'],
modernPolyfills: ['es.promise.finally'],
}),
AutoImport({
// 自动导入 Vue 相关函数,如:ref, reactive, toRef 等
imports: ['vue'],
resolvers: [
ElementPlusResolver(),
// 自动导入图标组件
IconsResolver({
prefix: 'Icon',
}),
],
}),
Components({
resolvers: [
ElementPlusResolver({
importStyle: 'sass',
// directives: true,
// version: "2.1.5",
}),
// 自动注册图标组件
IconsResolver({
enabledCollections: ['ep'],
}),
],
}),
Icons({
autoInstall: true,
}),
viteMockServe({
mockPath: 'mock',
supportTs: false,
localEnabled: isDev,
prodEnabled: !isDev,
injectCode: `
import { setupProdMockServer } from './mockProdServer';
setupProdMockServer();
`,
}),
svgBuilder('./src/icons/svg/'),
],
server: {
host,
port,
cors,
strictPort,
open,
fs: {
strict: false,
},
},
resolve: {
// 设置别名
alias: {
views: path.resolve(__dirname, 'src/views'),
styles: path.resolve(__dirname, 'src/styles'),
'@': path.resolve(__dirname, 'src'),
},
},
css: {
preprocessorOptions: {
// 引入公用的样式
scss: {
additionalData: `@use "@/styles/index.scss" as *; @use "@/styles/element/index.scss" as *;`,
charset: false,
},
},
},
corePlugins: {
preflight: false,
},
build: {
target: 'es2015',
outDir,
assetsDir,
sourcemap,
cssCodeSplit,
brotliSize,
// rollupOptions: {
// output: {
// // chunkFileNames: 'static/js/[name]-[hash].js',
// // entryFileNames: 'static/js/[name]-[hash].js',
// // assetFileNames: 'static/[ext]/[name]-[hash].[ext]',
// },
// },
terserOptions: {
compress: {
keep_infinity: true,
drop_console,
drop_debugger,
},
},
chunkSizeWarningLimit,
},
optimizeDeps: {
// 检测需要预构建的依赖项
include: [],
},
});
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。