简体   繁体   中英

how to read and remove too many unused js code in chunk

在此处输入图像描述

My nextjs project calls the main page, and 98% of unused bytes exist in one chunk of chunks.

When I looked into the code, there was a red line marked on this type of code.

"use strict";
eval(...)

I'm not sure what that means. Does it mean that the unused code was imported and used?

I need your help and a keyword to find a clue.

you're running your tests in a development environment. that's why you're shipping so much unused JS. to fix this run next build to generate an optimized bundle.

in production, if you want to figure out why a package was imported I suggest using bundle-analyzer .

as for what they are.

  • The eval() function evaluates JavaScript code represented as a string. source
  • "use strict"; Defines that JavaScript code should be executed in "strict mode". source

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM