Files
ghatreh_user/vite.config.ts
T

109 lines
3.4 KiB
TypeScript
Raw Normal View History

2025-10-05 09:44:14 +03:30
import {fileURLToPath, URL} from 'node:url'
import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import {VitePWA} from 'vite-plugin-pwa'
import UnoCSS from 'unocss/vite'
import {resolve} from "path";
import {AntDesignVueResolver, VantResolver} from 'unplugin-vue-components/resolvers';
import Components from 'unplugin-vue-components/vite'
// import {colors} from './src/themeConfig'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
vueJsx(),
VitePWA({
//registerType: 'autoUpdate',
devOptions: {
enabled: true
},
workbox: {
cleanupOutdatedCaches: false,
clientsClaim: true,
skipWaiting: true
},
mode: 'development',
base: '/',
srcDir: 'src',
filename: 'sw.ts',
includeAssets: ['/favicon.png'],
strategies: 'injectManifest',
manifest: {
2025-10-05 10:57:17 +03:30
name: 'ghatreh',
short_name: 'ghatreh',
2025-10-05 09:44:14 +03:30
start_url: '/',
display: 'standalone',
2025-10-21 17:09:16 +03:30
theme_color: '#521620',
2025-10-05 09:44:14 +03:30
orientation: "portrait-primary",
background_color: 'white',
icons: [
{
src: '32.png',
sizes: '32x32',
type: 'image/png',
purpose: 'any maskable',
},
{
src: '32.png',
sizes: '32x32',
type: 'image/png',
},
{
src: '192.png',
sizes: '192x192',
type: 'image/png',
},
{
src: '512.png',
sizes: '512x512',
type: 'image/png',
},
/* {
src: 'icon-512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'any maskable',
},*/
],
},
}),
UnoCSS({
configFile: './uno.config.ts',
}),
Components({
resolvers: [AntDesignVueResolver({importStyle: 'less'}), VantResolver(),],
}),
],
esbuild: {
supported: {
'top-level-await': true //browsers can handle top-level-await features
},
},
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
server: {
port: 3100,
},
// base: `/single`,
// base: `/customer`,
css: {
preprocessorOptions: {
less: {
modifyVars: {
// Used for global import to avoid the need to import each style file separately
// reference: Avoid repeated references
hack: `; @import (reference) "${resolve('src/assets/css/var.less')}"`,
},
javascriptEnabled: true,
},
},
},
})