以 ckcloudManage a44810c 为基础,只保留资产页面(台账、单据、基础数据、同步任务)、 登录/错误/个人资料等公共页面,以及资产单据“查看流程”用到的流程详情页; 统一登录应用编码默认 CK_ASSET,标题“资产管理”,本地端口 9090。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
/// <reference types="vitest/config" />
|
||||
import {resolve} from 'path'
|
||||
import type {ConfigEnv, UserConfig} from 'vite'
|
||||
import {loadEnv} from 'vite'
|
||||
import {createVitePlugins} from './build/vite'
|
||||
import {exclude, include} from "./build/vite/optimize"
|
||||
// 当前执行node命令时文件夹的地址(工作目录)
|
||||
const root = process.cwd()
|
||||
|
||||
// 路径查找
|
||||
function pathResolve(dir: string) {
|
||||
return resolve(root, '.', dir)
|
||||
}
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default ({mode}: ConfigEnv): UserConfig => {
|
||||
const env = loadEnv(mode, root)
|
||||
return {
|
||||
base: env.VITE_BASE_PATH,
|
||||
root: root,
|
||||
// 服务端渲染
|
||||
server: {
|
||||
port: Number(env.VITE_PORT) || undefined, // 端口号
|
||||
host: "0.0.0.0",
|
||||
open: env.VITE_OPEN === 'true'
|
||||
},
|
||||
// 项目使用的vite插件。 单独提取到build/vite/plugin中管理
|
||||
plugins: createVitePlugins(),
|
||||
css: {
|
||||
preprocessorOptions: {
|
||||
scss: {
|
||||
// 通过 Sass 搜索路径加载公共变量,兼容 macOS 下的绝对路径解析。
|
||||
loadPaths: [pathResolve('src/styles')],
|
||||
additionalData: '@use "variables.scss" as *;\n',
|
||||
javascriptEnabled: true,
|
||||
silenceDeprecations: ["legacy-js-api"], // 参考自 https://stackoverflow.com/questions/78997907/the-legacy-js-api-is-deprecated-and-will-be-removed-in-dart-sass-2-0-0
|
||||
}
|
||||
}
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.scss', '.css'],
|
||||
alias: [
|
||||
{
|
||||
find: 'vue-i18n',
|
||||
replacement: 'vue-i18n/dist/vue-i18n.cjs.js'
|
||||
},
|
||||
{
|
||||
find: /^@\//,
|
||||
replacement: `${pathResolve('src')}/`
|
||||
}
|
||||
]
|
||||
},
|
||||
build: {
|
||||
minify: 'terser',
|
||||
outDir: env.VITE_OUT_DIR || 'dist',
|
||||
sourcemap: env.VITE_SOURCEMAP === 'true' ? 'inline' : false,
|
||||
// brotliSize: false,
|
||||
terserOptions: {
|
||||
compress: {
|
||||
drop_debugger: env.VITE_DROP_DEBUGGER === 'true',
|
||||
drop_console: env.VITE_DROP_CONSOLE === 'true'
|
||||
}
|
||||
},
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks: {
|
||||
echarts: ['echarts'], // 将 echarts 单独打包
|
||||
'form-create': ['@form-create/element-ui'], // 表单组件单独打包
|
||||
'form-designer': ['@form-create/designer'],
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
optimizeDeps: {include, exclude},
|
||||
// 单元测试:复用上面的别名、插件(自动导入)与 SCSS 配置
|
||||
test: {
|
||||
environment: 'jsdom',
|
||||
globals: true,
|
||||
include: ['tests/unit/**/*.spec.ts'],
|
||||
setupFiles: ['tests/unit/setup.ts'],
|
||||
css: false,
|
||||
// element-plus 的按需样式(.css)需经 Vite 处理,不能交给 Node 直接加载
|
||||
server: {deps: {inline: ['element-plus']}},
|
||||
restoreMocks: true,
|
||||
clearMocks: true,
|
||||
testTimeout: 30000,
|
||||
coverage: {
|
||||
provider: 'v8',
|
||||
reporter: ['text-summary', 'text', 'html', 'lcov'],
|
||||
reportsDirectory: 'coverage',
|
||||
// 统计全部业务源码(含未被测试加载的文件);仅排除类型声明与生成文件
|
||||
include: ['src/**/*.{ts,tsx,vue}'],
|
||||
exclude: ['src/**/*.d.ts', 'src/types/**']
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user