import { fileURLToPath, URL } from 'node:url' import { extname } from 'node:path' import { defineConfig, splitVendorChunkPlugin } from 'vite' import vue from '@vitejs/plugin-vue' export default defineConfig({ plugins: [vue(), splitVendorChunkPlugin()], assetsInclude: ['/static/qm/three.js', '/static/qm/MainMap_QM.js'], base: './', build: { sourcemap: true, cssTarget: 'chrome61', rollupOptions: { output: { chunkFileNames: 'js/[name].[hash].js', entryFileNames: 'js/[name].[hash].js', assetFileNames: chunkInfo => { let subDir = 'images' if (extname(chunkInfo.name as string) === '.css') { subDir = 'css' } else if (extname(chunkInfo.name as string) === '.ttf') { subDir = 'font' } return `assets/${subDir}/[name].[hash].[ext]` } } } }, css: { preprocessorOptions: { scss: { additionalData: `@import "@/assets/scss/mixin.scss";` } } }, resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) } } })