123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- /// <reference types="vitest" />
- import { defineConfig, Plugin } 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 }) => ({
- 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
- }
- },
- build: {
- sourcemap: mode === 'production' ? false : 'inline'
- },
- server: {
- port: 3600,
- proxy: {
- // '/service': {
- // target: 'https://vr-test.scdjw.com.cn',
- // changeOrigin: true
- // },
- // '/scene_view_data': {
- // target: 'https://djqk-vr.obsv3.scrb-cd-1.sichuandaily.com.cn',
- // changeOrigin: true
- // },
- '/service': {
- target: 'https://vr-test.scdjw.com.cn',
- changeOrigin: true
- },
- '/page': {
- target: 'https://vr-test.scdjw.com.cn',
- changeOrigin: true,
- rewrite: (path) => path.replace(/^\/page/, '')
- }
- }
- }
- }))
|