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,66 +4,73 @@ 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({
plugins: [ export default defineConfig(async () => {
react({ const baseDomains = ['sozsoft.com', 'dev.sozsoft.com']
babel: {
plugins: ['babel-plugin-macros', '@babel/plugin-syntax-dynamic-import'], const res = await getTenants(0, 1000)
}, const tenantNames = (res?.items ?? [])
}), .filter(t => t?.name)
dynamicImport(), .map(t => t.name.trim().toLowerCase())
VitePWA({
registerType: 'autoUpdate', const tenantHosts = tenantNames.flatMap(t => baseDomains.map(d => `${t}.${d}`))
devOptions: { const allowedHosts = Array.from(new Set(['localhost', ...baseDomains, ...tenantHosts]))
enabled: true, console.log('Allowed Hosts:', allowedHosts)
}, return {
workbox: { plugins: [
maximumFileSizeToCacheInBytes: 10 * 1024 * 1024, // 10 MB sınır react({
}, babel: {
manifest: { plugins: ['babel-plugin-macros', '@babel/plugin-syntax-dynamic-import'],
name: 'Platform', },
theme_color: '#FF99C8', }),
background_color: '#f0e7db', dynamicImport(),
display: 'standalone', VitePWA({
// scope: '/', registerType: 'autoUpdate',
// start_url: '/', devOptions: { enabled: true },
// orientation: 'portrait', workbox: {
icons: [ maximumFileSizeToCacheInBytes: 10 * 1024 * 1024,
{ },
src: '/img/logo/logo-400.png', manifest: {
sizes: '400x400', name: 'Platform',
type: 'image/png', theme_color: '#FF99C8',
purpose: 'any', background_color: '#f0e7db',
}, display: 'standalone',
], icons: [
}, {
}), src: '/img/logo/logo-400.png',
// visualizer({ open: true, filename: 'bundle-visualization.html' }), sizes: '400x400',
], type: 'image/png',
server: { purpose: 'any',
open: true, },
port: 3000, ],
}, },
assetsInclude: ['**/*.md'], }),
resolve: { ],
alias: { server: {
'@': path.join(__dirname, 'src'), open: true,
inferno: 'inferno/dist/index.esm.js', port: 3000,
'devextreme/ui': 'devextreme/esm/ui',
}, },
}, assetsInclude: ['**/*.md'],
build: { resolve: {
outDir: 'dist', alias: {
sourcemap: false, '@': path.join(__dirname, 'src'),
}, inferno: 'inferno/dist/index.esm.js',
preview: { 'devextreme/ui': 'devextreme/esm/ui',
host: '0.0.0.0', },
port: 80, },
open: false, build: {
allowedHosts: ['localhost', 'sozsoft.com', 'dev.sozsoft.com', 'demo.sozsoft.com'], outDir: 'dist',
}, sourcemap: false,
define: { },
'process.env': {}, preview: {
}, host: '0.0.0.0',
port: 80,
open: false,
allowedHosts,
},
define: {
'process.env': {},
},
}
}) })