Published: 18 Sept 2022 › Updated: 18 Sept 2022
next.js with webpack bundle analyzer
When you deploy a service,
you should try to reduce the package size. You can use webpack bundle analyzer to check the package size.
I tried to setup next.js with webpack bundle analyzer, but the setup failed.
No search results were found for the above combination.
So, I used the package below.
@next/bundle-analyzer
https://github.com/vercel/next.js/tree/canary/packages/next-bundle-analyzer
It exists on the next.js github page.
Here are a few notes to keep in mind while setting it up.
- I recommend using next-compose-plugins to configure packages dynamically.
- It took me a while to find this setting.
Configure the package referring to the settings below.
package.json
"scripts": {
...
"analyze": "ANALYZE=true next build"
},
"devDependencies": {
...
"next-compose-plugins": "^2.2.1",
"@next/bundle-analyzer": "^12.3.0",
}
next.config.js
/** @type {import('next').NextConfig} */
const withPlugins = require('next-compose-plugins');
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
});
module.exports = withPlugins([[withBundleAnalyzer]], {
reactStrictMode: false,
compress: true,
});
run
% yarn analyze
Leave next.js with webpack bundle analyzer to:
Read more #hive-152717 posts
Best Posts From suseona
We have not curated any of pishio's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From suseona
- blog.suseona.com updates
- Hive Note MCP in the Claude Code
- Discovering Hive Note!
- The Rollercoaster of Trading: Chasing Profits in the Digital Wild West
- A Day Full of Bubbles and Pure Joy
- New AI Features on
- Weekend Diary
- A rewarding day.
- Successful today as well.
- Today is the zoo.
- A Day in May
- Building “Maknae Life” Game with AI: From Frontend Logic to Backend
- Writing a Post with OpenClaw
- Solar System 3D
- hourglass online hourglass ⏳
- Suseona Blog : Enhanced Performance & User Experience
- Updated Suseona Blog
- Visualizing Tides in 3D
- #1 호갱노노 만들어보기 with Google Antigravity
- Gemini로 호갱노노 만들어 보기