Nextjs performance problem,
Unanswered
Spectacled bear posted this in #help-forum
Spectacled bearOP
How am I getting worse performance on my landing page when I'm using dynamic imports, if I'd use static imports then it would be 30%. Why is my performance so bad? What can I do?
Landingpage:
Ë›
Landingpage:
Ë›
import Link from "next/link";
import { styles } from "../utils/contants";
import CTA from "../components/Landingpage/CTA";
import Footer from "../components/Landingpage/Footer";
import { ToastContainer } from "react-toastify";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import SocialMedia from "@/components/Landingpage/SocialMedia";
import { useEffect } from "react";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
import Intro from "@/components/Landingpage/Intro";
import dynamic from "next/dynamic";
const Navbar = dynamic(() => import("@/components/Landingpage/Navbar"));
const Hero = dynamic(() => import("@/components/Landingpage/Hero"));
const Features = dynamic(() => import("@/components/Landingpage/Features"));
const Suggestion = dynamic(
() => import("@/components/Landingpage/Suggestion")
);
const SuggestionMobile = dynamic(
() => import("@/components/Landingpage/SuggestionMobile")
);
return (
<div className="bg-primary w-full overflow-hidden">
<div className={`sm:px-16 px-6 flex justify-center items-center`}>
<div className={`xl:max-w-[1280px] w-full`}>
<Navbar />
</div>
</div>
<div className={`bg-primary hero-base flex justify-center items-start`}>
<div className={`${styles.boxWidth}`}>
<Hero />
</div>
</div>
<div className={`bg-primary ${styles.paddingX} ${styles.flexCenter}`}>
<div className={`${styles.boxWidth}`}>
<Intro />
<Features />
<SuggestionMobile />
<Suggestion />
<SocialMedia />
<CTA />
<Footer />
</div>
</div>
</div>
);
};
export default Home;13 Replies
Spectacled bearOP
pages
@DirtyCajunRice | AppDir that is impressive
Spectacled bearOP
😄 Thank you
@DirtyCajunRice | AppDir i dont think ive ever seen that low
Spectacled bearOP
The weird thing is that after if I remove the dynamic imports then it goes back to 30%
aw damn. if it was app dir i could help. i have no idea about pages tho
@Spectacled bear The weird thing is that after if I remove the dynamic imports then it goes back to 30%
yeah that is ass backwards as far as i am aware
@DirtyCajunRice | AppDir yeah that is ass backwards as far as i am aware
Spectacled bearOP
Well IDK, but my production site has the performance of 97% which is compared to what I've got locally is again weird af
keep in mind that dev server royally fucks up lighthouse
if you wanna test lighthouse you gotta build+start
(because of hmr)
Spectacled bearOP
I see