Files
screen/vite.config.mts
❀ » Cato Sweeney. ❀ » Console@the.bb fd39822a14 first commit
2025-11-26 09:46:45 +08:00

98 lines
2.3 KiB
TypeScript

import { loadEnv, defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
import glsl from 'rollup-plugin-glsl'
function pathResolve(dir) {
return resolve(process.cwd(), '.', dir)
}
// https://vitejs.dev/config/
export default ({ mode }) => {
return defineConfig({
base: '/',
plugins: [
vue(),
glsl({
// By default, everything gets included
include: '**/*.glsl',
// Undefined by default
exclude: ['**/index.html'],
// Source maps are on by default
// sourceMap: false,
}),
],
css:{
preprocessorOptions:{
scss:{
api:"modern-compiler"
}
}
},
server: {
host: '0.0.0.0',
port: 8086,
open: true,
},
resolve: {
alias: {
'@': pathResolve('./src'),
},
},
optimizeDeps: {
include: [
'axios',
'vue',
'vue-router',
'pinia',
'dayjs',
'echarts',
'element-plus',
'js-cookie',
'mockjs',
'brace',
'three',
'gsap',
],
exclude: [],
},
build: {
sourcemap: false,
outDir: 'dist',
rollupOptions: {
output: {
chunkFileNames: 'static/js/[name]-[hash].js',
entryFileNames: 'static/js/[name]-[hash].js',
assetFileNames: 'static/[ext]/[name]-[hash].[ext]',
manualChunks(id) {
if (id.includes('/node_modules/')) {
// 设置需要独立打包的npm包
const expansions = [
'element-plus',
'brace',
'particles.vue3',
'mockjs',
'three',
'gsap',
]
const c = expansions.find(exp => id.includes(`/node_modules/${exp}`))
if (c) {
return `chunk-${c}`
} else {
return 'vendor'
}
}
},
},
},
// Turning off brotliSize display can slightly reduce packaging time
chunkSizeWarningLimit: 2000,
},
define: {
// enable hydration mismatch details in production build
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: 'true',
},
})
}