123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- import { resolve } from 'path';
- import { defineConfig } from 'vite';
- import vue from '@vitejs/plugin-vue';
- import vueJsx from '@vitejs/plugin-vue-jsx';
- import { vitePluginCommonjs } from 'vite-plugin-commonjs';
- import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
- import eslint from 'vite-plugin-eslint';
- import VueSetupExtend from 'vite-plugin-vue-setup-extend';
- import AutoImport from 'unplugin-auto-import/vite';
- import { visualizer } from 'rollup-plugin-visualizer';
- import viteCompression from 'vite-plugin-compression';
- import { createHtmlPlugin } from 'vite-plugin-html';
- import { name } from './package.json';
- export default defineConfig(({ command, mode }) => {
-
- const proxy = {
- '/apictis': {
-
-
- target: 'http://172.16.46.110:7002',
-
-
- changeOrigin: true,
- rewrite: (path) => path.replace(/^\/apictis/, ''),
- },
- };
- const plugins = [
- viteCompression(),
- createHtmlPlugin({
- minify: true,
- inject: {
- data: {
- title: name,
- },
- },
- }),
- vue({
- reactivityTransform: true,
- }),
- vueJsx(),
- vitePluginCommonjs(),
-
- AutoImport({
-
- dts: 'src/auto-imports.d.ts',
- imports: ['vue'],
-
- eslintrc: {
- enabled: true,
- },
- }),
- createSvgIconsPlugin({
-
- iconDirs: [resolve(process.cwd(), 'src/icons')],
-
- symbolId: 'icon-[dir]-[name]',
- }),
- eslint({
- include: ['src/**/*.ts', 'src/**/*.tsx', 'src/**/*.vue'],
- exclude: ['node_modules'],
- }),
- ];
- if (process.env.report) {
- plugins.push(
- visualizer({ open: true, brotliSize: true, filename: 'report.html' })
- );
- }
- return {
- base: './',
- server: {
- proxy,
- },
- build: {
- reportCompressedSize: false,
- rollupOptions: {
- output: {
- manualChunks: {
- echarts: ['echarts', 'vue-echarts'],
- i18n: ['vue-i18n'],
- arcoDesign: ['@arco-design/web-vue'],
- dayjs: ['dayjs'],
- },
- },
- },
- },
- plugins,
- resolve: {
- alias: [
- {
- find: '@',
- replacement: resolve(__dirname, 'src'),
- },
- ],
- extensions: ['.ts', '.js'],
- },
- css: {
- preprocessorOptions: {
- less: {
- modifyVars: {
-
- },
- javascriptEnabled: true,
- },
- },
- },
- define: {
- 'process.env': {},
- },
- test: {},
- };
- });
|