Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Main.js is rendered on every page even if I splitted each page into chunks with @loadable/component #988

Open
burakkbilginn opened this issue Nov 25, 2023 · 0 comments

Comments

@burakkbilginn
Copy link

💬 Questions and Help

Main.js is rendered on every page even if I splitted each page into chunks with @loadable/component

Code is below:

import loadable from '@loadable/component';

const Home = loadable(() => import(/* webpackChunkName: 'home' */ './pages/home/Home'));
const Kredi = loadable(() => import(/* webpackChunkName: 'kredichunk' */ './pages/kredi/Kredi'));
const BlogMainpage = loadable(() => import(/* webpackChunkName: 'blogmainpage' */ './pages/blogmainpage/BlogMainpage'));

function App() {
  
  return (
    <>
      {/* <Suspense fallback={<div>Loading...</div>}> */}
        <BrowserRouter>
          <Header />
          <Routes>
            <Route path="/" element={<Home />} />
            <Route path="/blog" element={<BlogMainpage />} />
            <Route path="/kredi" element={<Kredi />} />
          </Routes>
        </BrowserRouter>
   </>
)}

I.e when I open directly www.xx.com/kredi, I see that main.js and kredichunk.js is loaded on chrome's network tab.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant