123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- import { fileURLToPath, URL } from 'node:url'
- import { defineConfig } from 'vite'
- import vue from '@vitejs/plugin-vue'
- import vueJsx from '@vitejs/plugin-vue-jsx'
- import Components from 'unplugin-vue-components/vite'
- import { VantResolver } from '@vant/auto-import-resolver'
- import { resolve } from 'path'
- // https://vitejs.dev/config/
- export default defineConfig({
- base: './',
- plugins: [
- vue(),
- vueJsx(),
- Components({
- resolvers: [VantResolver()]
- })
- ],
- resolve: {
- alias: {
- '@': fileURLToPath(new URL('./src', import.meta.url))
- }
- },
- build: {
- rollupOptions: {
- input: {
- coverHome: resolve(__dirname, 'cover-home/index.html'),
- monument: resolve(__dirname, 'monument/index.html'),
- bookFair: resolve(__dirname, 'book-fair/index.html'),
- tongyan: resolve(__dirname, 'tongyan/index.html'),
- birds: resolve(__dirname, 'birds/index.html'),
- wedding: resolve(__dirname, 'wedding/index.html')
- },
- output: {
- assetFileNames: (assetInfo) => {
- const name = assetInfo.name ?? ''
- const info = name.split('.')
- let extType = info[info.length - 1]
- if (/\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/i.test(name)) {
- extType = 'media'
- } else if (/\.(png|jpe?g|gif|svg)(\?.*)?$/.test(name)) {
- extType = 'imgs'
- } else if (/\.(woff2?|eot|ttf|otf)(\?.*)?$/i.test(name)) {
- extType = 'fonts'
- }
- return `static/${extType}/[name]-[hash][extname]`
- },
- chunkFileNames: 'static/js/[name]-[hash].js',
- entryFileNames: 'static/js/[name]-[hash].js'
- }
- }
- }
- })
|