Next.js Discord

Discord Forum

Need help in optimising initial load js of _app.js

Unanswered
Polar bear posted this in #help-forum
Open in Discord
Polar bearOP
I need help in reducing initial loads js

I have attached the picture of the next-bundle-analyzer report of my _app's initial load js.

I am dynamically importing mathjs library to remove it from the server-side js


useEffect(() => {
const loadMathJsAndEvaluate = async () => {
const mathjs = await import('mathjs');
const { create, evaluateDependencies } = mathjs;
const math = create(evaluateDependencies);
setMath(math);
};

loadMathJsAndEvaluate();
}, []);


Even after importing it on the client side, how is it still part of the initial load js of _app, I am not importing it in _app?

0 Replies