代码拉取完成,页面将自动刷新
同步操作将从 卓源软件/JeeSite Vue3 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
/**
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
* No deletion without permission, or be held responsible to law.
* @author ThinkGem
*/
import type { UserConfig, ConfigEnv } from 'vite';
import { AliasOptions, defineConfig, loadEnv, ResolveOptions } from 'vite';
import { PackageJson, readPackageJSON } from 'pkg-types';
import { createVitePlugins } from './build/vite/plugin';
import { generateModifyVars } from './build/generate/modifyVars';
import { createProxy } from './build/vite/proxy';
import { wrapperEnv } from './build/utils';
import { resolve } from 'node:path';
import dayjs from 'dayjs';
export default defineConfig(async ({ command, mode }: ConfigEnv) => {
const root = process.cwd();
const isBuild = command === 'build';
const env = loadEnv(mode, root);
const viteEnv = wrapperEnv(env);
const timestamp = new Date().getTime();
const pkg = await readPackageJSON(root);
const config: UserConfig = {
root,
base: viteEnv.VITE_PUBLIC_PATH,
define: createDefineOptions(pkg),
plugins: createVitePlugins(isBuild, viteEnv, pkg),
resolve: createResolveOptions(root),
server: {
https: false as any,
open: false,
host: true,
port: viteEnv.VITE_PORT,
proxy: createProxy(viteEnv.VITE_PROXY),
warmup: {
clientFiles: ['./index.html', './src/{views,components}/*'],
},
},
esbuild: {
// pure: viteEnv.VITE_DROP_CONSOLE ? ['console.log', 'debugger'] : [],
drop: mode === 'production' ? ['console', 'debugger'] : [],
},
build: {
// target: 'es2015',
// 兼容 Chrome 内核比较低的浏览器,如 360、QQ 浏览器
cssTarget: 'chrome80',
outDir: env.VITE_OUTPUT_DIR ?? 'dist',
// 启用 terser 缩小器,当设置 terserOptions 时才会有效
// minify: 'terser',
// terserOptions: {
// compress: {
// keep_infinity: true,
// drop_console: viteEnv.VITE_DROP_CONSOLE,
// },
// },
// 禁用报告压缩块大小,可以稍微提高构建速度
reportCompressedSize: false,
chunkSizeWarningLimit: 9000,
rollupOptions: {
// maxParallelFileOps: 3,
output: {
entryFileNames: `assets/[name]-[hash]-${timestamp}.js`,
// manualChunks: {
// vue: ['vue', 'vue-router', 'pinia'],
// antdv: ['ant-design-vue', '@ant-design/icons-vue'],
// },
},
},
},
optimizeDeps: {
include: [
'qrcode',
'echarts/core',
'echarts/charts',
'echarts/components',
'echarts/renderers',
'@iconify/iconify',
'ant-design-vue/es/locale/zh_CN',
'ant-design-vue/es/locale/en_US',
],
},
css: {
preprocessorOptions: {
less: {
modifyVars: generateModifyVars(),
javascriptEnabled: true,
},
},
},
};
return config;
});
function createResolveOptions(root: string) {
const pathResolve = (pathname: string) => resolve(root, '.', pathname);
const resolveData: ResolveOptions & { alias?: AliasOptions } = {
alias: [
{
find: 'vue-i18n',
replacement: 'vue-i18n/dist/vue-i18n.cjs.js',
},
{
find: /\/@\//, // /@/xxxx => src/xxxx
replacement: pathResolve('src') + '/',
},
{
find: /\/#\//, // /#/xxxx => types/xxxx
replacement: pathResolve('types') + '/',
},
],
};
return resolveData;
}
function createDefineOptions(pkg: PackageJson) {
try {
const { dependencies, devDependencies, name, version } = pkg;
const __APP_INFO__ = {
pkg: { dependencies, devDependencies, name, version },
lastBuildTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
};
return {
// __INTLIFY_PROD_DEVTOOLS__: 'false',
__APP_INFO__: JSON.stringify(__APP_INFO__),
};
} catch (error) {
console.log('createDefine', error);
return {};
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。