12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- import { fileURLToPath, URL } from 'node:url'
- import { defineConfig } from 'vite'
- import vue from '@vitejs/plugin-vue'
- import vueJsx from '@vitejs/plugin-vue-jsx'
- const Timestamp = new Date().getTime();
- // https://vitejs.dev/config/
- export default defineConfig({
- // base: '/highLevelIntellectual/',
- build: {
- chunkSizeWarningLimit: 1500,
- rollupOptions: {
- output: {
- // 最小化拆分包
- manualChunks(id) {
- if (id.includes('node_modules')) {
- return id.toString().split('node_modules/')[1].split('/')[0].toString()
- }
- },
- // 用于从入口点创建的块的打包输出格式[name]表示文件名,[hash]表示该文件内容hash值
- entryFileNames: `assets/js/[name].[hash].${Timestamp}.js`, // 用于命名代码拆分时创建的共享块的输出命名
- chunkFileNames: `assets/js/[name].[hash].${Timestamp}.js`, // 用于输出静态资源的命名,[ext]表示文件扩展名
- assetFileNames: `assets/[ext]/[name].[hash].${Timestamp}.[ext]`
- }
- }
- },
- base: '/fireBrigade/',
- css: {
- preprocessorOptions: {
- scss: {
- api: "modern-compiler" // or 'modern'
- }
- }
- },
- plugins: [
- vue(),
- vueJsx(),
- ],
- server: { // ← ← ← ← ← ←
- host: '0.0.0.0', // ← 新增内容 ←
- // port: 8991,
- },
- resolve: {
- alias: {
- '@': fileURLToPath(new URL('./src', import.meta.url))
- }
- }
- })
|