This commit is contained in:
Sedat Öztürk 2025-08-12 01:08:28 +03:00
parent fc5a4c3d7c
commit cb8c224a54
2 changed files with 73 additions and 62 deletions

View file

@ -6,5 +6,9 @@
"moduleResolution": "Node", "moduleResolution": "Node",
"allowSyntheticDefaultImports": true "allowSyntheticDefaultImports": true
}, },
"include": ["vite.config.ts"] "include": [
"vite.config.ts",
"src/**/*.ts",
"src/**/*.tsx"
]
} }

View file

@ -4,8 +4,20 @@ import path from 'path'
import dynamicImport from 'vite-plugin-dynamic-import' import dynamicImport from 'vite-plugin-dynamic-import'
import { VitePWA } from 'vite-plugin-pwa' import { VitePWA } from 'vite-plugin-pwa'
// https://vitejs.dev/config/ import { getTenants } from './src/proxy/admin/tenant/tenant.service'
export default defineConfig({
export default defineConfig(async () => {
const baseDomains = ['sozsoft.com', 'dev.sozsoft.com']
const res = await getTenants(0, 1000)
const tenantNames = (res?.items ?? [])
.filter(t => t?.name)
.map(t => t.name.trim().toLowerCase())
const tenantHosts = tenantNames.flatMap(t => baseDomains.map(d => `${t}.${d}`))
const allowedHosts = Array.from(new Set(['localhost', ...baseDomains, ...tenantHosts]))
console.log('Allowed Hosts:', allowedHosts)
return {
plugins: [ plugins: [
react({ react({
babel: { babel: {
@ -15,20 +27,15 @@ export default defineConfig({
dynamicImport(), dynamicImport(),
VitePWA({ VitePWA({
registerType: 'autoUpdate', registerType: 'autoUpdate',
devOptions: { devOptions: { enabled: true },
enabled: true,
},
workbox: { workbox: {
maximumFileSizeToCacheInBytes: 10 * 1024 * 1024, // 10 MB sınır maximumFileSizeToCacheInBytes: 10 * 1024 * 1024,
}, },
manifest: { manifest: {
name: 'Platform', name: 'Platform',
theme_color: '#FF99C8', theme_color: '#FF99C8',
background_color: '#f0e7db', background_color: '#f0e7db',
display: 'standalone', display: 'standalone',
// scope: '/',
// start_url: '/',
// orientation: 'portrait',
icons: [ icons: [
{ {
src: '/img/logo/logo-400.png', src: '/img/logo/logo-400.png',
@ -39,7 +46,6 @@ export default defineConfig({
], ],
}, },
}), }),
// visualizer({ open: true, filename: 'bundle-visualization.html' }),
], ],
server: { server: {
open: true, open: true,
@ -61,9 +67,10 @@ export default defineConfig({
host: '0.0.0.0', host: '0.0.0.0',
port: 80, port: 80,
open: false, open: false,
allowedHosts: ['localhost', 'sozsoft.com', 'dev.sozsoft.com', 'demo.sozsoft.com'], allowedHosts,
}, },
define: { define: {
'process.env': {}, 'process.env': {},
}, },
}
}) })