diff --git a/frontend/babel.config.js b/frontend/babel.config.js index 43dfc43a8..2c635521b 100644 --- a/frontend/babel.config.js +++ b/frontend/babel.config.js @@ -6,6 +6,7 @@ module.exports = { targets: { browsers: ['last 2 versions', 'not dead', 'not ie <= 11'], }, + modules: false, }, ], ['@babel/preset-react'], diff --git a/frontend/src/router.tsx b/frontend/src/router.tsx index ce56ae7ad..4ae819044 100644 --- a/frontend/src/router.tsx +++ b/frontend/src/router.tsx @@ -1,20 +1,21 @@ import { createBrowserRouter } from 'react-router-dom'; import Home from './pages/Home'; -import NewPin from './pages/NewPin'; -import NewTopic from './pages/NewTopic'; import RootPage from './pages/RootPage'; -import SelectedTopic from './pages/SelectedTopic'; -import SeeAllPopularTopics from './pages/SeeAllPopularTopics'; -import SeeAllNearTopics from './pages/SeeAllNearTopics'; -import SeeAllLatestTopics from './pages/SeeAllLatestTopics'; -import KakaoRedirect from './pages/KakaoRedirect'; -import { ReactNode } from 'react'; +import { ReactNode, lazy } from 'react'; import AuthLayout from './components/Layout/AuthLayout'; import NotFound from './pages/NotFound'; -import SeeTogetherTopics from './pages/SeeTogetherTopics'; -import Profile from './pages/Profile'; -import AskLogin from './pages/AskLogin'; -import Bookmark from './pages/Bookmark'; + +const SelectedTopic = lazy(() => import('./pages/SelectedTopic')); +const NewPin = lazy(() => import('./pages/NewPin')); +const NewTopic = lazy(() => import('./pages/NewTopic')); +const SeeAllPopularTopics = lazy(() => import('./pages/SeeAllPopularTopics')); +const SeeAllNearTopics = lazy(() => import('./pages/SeeAllNearTopics')); +const SeeAllLatestTopics = lazy(() => import('./pages/SeeAllLatestTopics')); +const KakaoRedirect = lazy(() => import('./pages/KakaoRedirect')); +const SeeTogetherTopics = lazy(() => import('./pages/SeeTogetherTopics')); +const Profile = lazy(() => import('./pages/Profile')); +const AskLogin = lazy(() => import('./pages/AskLogin')); +const Bookmark = lazy(() => import('./pages/Bookmark')); interface routeElement { path: string;