111 lines
3.5 KiB
TypeScript
111 lines
3.5 KiB
TypeScript
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 {useConfigStore} from "./src/store/configStore";
|
|
// import {colors} from './src/themeConfig'
|
|
|
|
// https://vitejs.dev/config/
|
|
// const config=useConfigStore()
|
|
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: {
|
|
name: ``,
|
|
short_name: ``,
|
|
start_url: '/',
|
|
display: 'standalone',
|
|
theme_color: '#0A1B37',
|
|
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,
|
|
},
|
|
},
|
|
},
|
|
})
|