npm run build üzerinde NotFound uyarısı verdi
This commit is contained in:
parent
012f507cd3
commit
b66c4a4aa7
4 changed files with 12 additions and 6 deletions
|
|
@ -82,7 +82,7 @@ define(['./workbox-54d0af47'], (function (workbox) { 'use strict';
|
||||||
"revision": "3ca0b8505b4bec776b69afdba2768812"
|
"revision": "3ca0b8505b4bec776b69afdba2768812"
|
||||||
}, {
|
}, {
|
||||||
"url": "index.html",
|
"url": "index.html",
|
||||||
"revision": "0.ettrttb2g3"
|
"revision": "0.0ii4qr2m5co"
|
||||||
}], {});
|
}], {});
|
||||||
workbox.cleanupOutdatedCaches();
|
workbox.cleanupOutdatedCaches();
|
||||||
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {
|
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@ import { RouteDto } from '@/proxy/routes/models'
|
||||||
import { lazy } from 'react'
|
import { lazy } from 'react'
|
||||||
|
|
||||||
// Tüm view bileşenlerini import et (vite özel)
|
// Tüm view bileşenlerini import et (vite özel)
|
||||||
const modules = import.meta.glob('../views/**/*.tsx')
|
// shared klasörü hariç, çünkü bu bileşenler genellikle başka yerlerde statik import ediliyor
|
||||||
|
const modules = import.meta.glob(['../views/**/*.tsx', '!../views/shared/**/*.tsx'])
|
||||||
|
|
||||||
const lazyComponentCache = new Map<string, React.LazyExoticComponent<React.ComponentType<any>>>()
|
const lazyComponentCache = new Map<string, React.LazyExoticComponent<React.ComponentType<any>>>()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
import React, { useMemo } from 'react'
|
import React, { useMemo } from 'react'
|
||||||
import { Routes, Route, Navigate } from 'react-router-dom'
|
import { Routes, Route, Navigate } from 'react-router-dom'
|
||||||
import { mapDynamicRoutes } from './dynamicRouteLoader'
|
import { mapDynamicRoutes, loadComponent } from './dynamicRouteLoader'
|
||||||
import { useDynamicRoutes } from './dynamicRoutesContext'
|
import { useDynamicRoutes } from './dynamicRoutesContext'
|
||||||
import NotFound from '@/views/NotFound'
|
|
||||||
import ProtectedRoute from '@/components/route/ProtectedRoute'
|
import ProtectedRoute from '@/components/route/ProtectedRoute'
|
||||||
import PermissionGuard from '@/components/route/PermissionGuard'
|
import PermissionGuard from '@/components/route/PermissionGuard'
|
||||||
import PageContainer from '@/components/template/PageContainer'
|
import PageContainer from '@/components/template/PageContainer'
|
||||||
|
|
@ -13,6 +12,7 @@ export const DynamicRouter: React.FC = () => {
|
||||||
const { routes, loading, error } = useDynamicRoutes()
|
const { routes, loading, error } = useDynamicRoutes()
|
||||||
|
|
||||||
const dynamicRoutes = useMemo(() => mapDynamicRoutes(routes), [routes])
|
const dynamicRoutes = useMemo(() => mapDynamicRoutes(routes), [routes])
|
||||||
|
const NotFoundComponent = useMemo(() => loadComponent('views/NotFound'), [])
|
||||||
|
|
||||||
if (loading) return <div>Loading...</div>
|
if (loading) return <div>Loading...</div>
|
||||||
if (error) return <div>Hata: {error}</div>
|
if (error) return <div>Hata: {error}</div>
|
||||||
|
|
@ -75,7 +75,13 @@ export const DynamicRouter: React.FC = () => {
|
||||||
<Route
|
<Route
|
||||||
path="*"
|
path="*"
|
||||||
element={
|
element={
|
||||||
hasSubdomain() ? <Navigate to={ROUTES_ENUM.authenticated.login} replace /> : <NotFound />
|
hasSubdomain() ? (
|
||||||
|
<Navigate to={ROUTES_ENUM.authenticated.login} replace />
|
||||||
|
) : (
|
||||||
|
<React.Suspense fallback={<div>Loading...</div>}>
|
||||||
|
<NotFoundComponent />
|
||||||
|
</React.Suspense>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</Routes>
|
</Routes>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import { ROUTES_ENUM } from '@/routes/route.constant'
|
import { ROUTES_ENUM } from '@/routes/route.constant'
|
||||||
import React from 'react'
|
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
|
|
||||||
const NotFoundPage = () => {
|
const NotFoundPage = () => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue