最佳答案
看起来您正在使用 webpack,这里有一些需要尝试的事情:
<强> Code Splitting
Code splitting is one of the most compelling features of webpack. This feature allows you to split your code into various bundles which can then be loaded on demand or in parallel. It can be used to achieve smaller bundles and control resource load prioritization which, if used correctly, can have a major impact on load time.
<强> Tree Shaking
Tree shaking is a term commonly used in the JavaScript context for dead-code elimination. It relies on the static structure of ES2015 module syntax, i.e. import and export. The name and concept have been popularized by the ES2015 module bundler rollup.
关于javascript - Next.js - bundle 大小太大 (~3MB),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50501059/