I am working Next.js, Reactjs project. I want to remove chunk js files from _next/static/chunks
folder because Lighthouse showing remove unused JS. Is this possible to remove all chunk files.
Code splitting is an optimization technique that aims to reduce the size of an app's (first) payload by splitting or breaking the code modules into chunks and serving them only when needed. Next. js is a development framework that enables React-based applications functionalities.
js Compiler introduced. The Next. js Compiler, written in Rust using SWC, allows Next. js to transform and minify your JavaScript code for production.
Improved Tree Shaking: CommonJS modules can now be tree shaken to automatically remove unused code. Static analysis is used to determine side-effect free modules.
Minification is the process of removing unnecessary code formatting and comments without changing the code's functionality. The goal is to improve the application's performance by decreasing file sizes. In Next. js, JavaScript and CSS files are automatically minified for production.
These chunks are for converting your jsx
or tsx
files from js
to html
.
That's the whole concept of single-page applications (SPAs). Fast refreshing and state management are all controlled by those chunks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With