1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- /// <reference types="vitest" />
- import { defineConfig, Plugin,loadEnv } from 'vite'
- import vue from '@vitejs/plugin-vue'
- import tsconfigPaths from 'vite-tsconfig-paths'
- import vueJsx from '@vitejs/plugin-vue-jsx'
- // import IstanbulPlugin from 'vite-plugin-istanbul'
- const plugins: Array<Plugin> = [vue(), tsconfigPaths(), vueJsx()]
- if (process.env.CYPRESS_TEST === 'true') {
- // console.info('instrumenting code coverage for e2e tests...')
- // plugins.push(
- // IstanbulPlugin({
- // cypress: true,
- // checkProd: true,
- // exclude: ['dist', '.nyc_output', 'node_modules', 'coverage', 'test'],
- // include: ['src/*']
- // })
- // )
- }
- // https://vitejs.dev/config/
- //@ts-ignore
- export default defineConfig(({ mode }) => {
- const viteEnv = loadEnv(mode, process.cwd())
- const { VITE_KANKAN_PROXY } = viteEnv
- return {
- plugins,
- test: {
- server: {
- deps: {
- inline: ['date-fns']
- }
- },
- environment: 'happy-dom',
- globals: true,
- coverage: {
- all: true,
- exclude: [
- '*.config.{ts,js}',
- '**/*.d.ts',
- 'src/main.ts',
- 'dist',
- 'test'
- ],
- functions: 80,
- branches: 80,
- statements: 80
- }
- },
- base: mode == 'development'?'':'extend',
- build: {
- sourcemap: mode === 'production' ? false : 'inline'
- },
- server: {
- port: 3600,
- proxy: {
- '/service': {
- target: 'https://vr-test.scdjw.com.cn',
- changeOrigin: true
- },
- '/kankan': {
- target: VITE_KANKAN_PROXY,
- changeOrigin: true,
- rewrite: (path) => path.replace(/^\/kankan/, '')
- }
- }
- }
- }
- })
|