123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- import { defineConfig } from 'vite'
- import vue from '@vitejs/plugin-vue'
- import topLevelAwait from 'vite-plugin-top-level-await'
- import { resolve } from 'path'
- import viteCompression from 'vite-plugin-compression';
- import { visualizer } from "rollup-plugin-visualizer";
- import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
- import VitePluginHtmlEnv from 'vite-plugin-html-env'
- import postcsspxtoviewport from 'postcss-px-to-viewport'
- const time = new Date().getTime()
- export default defineConfig({
- define: {
- 'process.env': process.env
- },
- plugins: [
- vue(),
- viteCompression(),
- VitePluginHtmlEnv(),
- visualizer(),
- createSvgIconsPlugin({
-
- iconDirs: [resolve(process.cwd(), 'src/assets/svg')],
-
- symbolId: 'icon-[dir]-[name]',
-
-
-
-
-
-
-
-
-
-
- }),
- topLevelAwait({
- promiseExportName: '__tla',
- promiseImportName: i => `__tla_${i}`
- })
- ],
- base: './',
- resolve: {
- alias: {
- '@': resolve(__dirname, 'src'),
- },
- },
- server: {
- port: 3853,
- host: '0.0.0.0',
- open: true,
- strictPort: false,
- proxy: {
- '/mock-api': {
- target: 'http://localhost:18061/',
- changeOrigin: true,
- rewrite: (path) => {
- return path.replace(/^\/mock-api/, 'mock-api')
- }
- },
- '/ssw-api/api': {
-
- target: 'http://8.130.72.63:18068/',
- changeOrigin: true,
- rewrite: (path) => {
- return path.replace(/^\/ssw-api\/api/, '')
-
-
- }
- },
- '/ws-api': {
- target: 'ws://8.130.72.63:18073/',
-
- ws: true,
- changeOrigin: true,
- rewrite: path => {
- return path.replace(/^\/ws-api/, '')
- }
- },
- }
- },
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- build: {
- outDir: "smart-search-web",
- rollupOptions: {
- output: {
- manualChunks(id) {
- if (id.includes('node_modules')) {
- return time + id.toString().split('node_modules/')[1].split('/')[0].toString();
- } else {
- return time + id.toString();
- }
- }
- }
- }
- },
- publicDir: 'src/out',
- optimizeDeps: {
- include: []
- }
- } as any)
|