Hey guys,
I have built my nextjs file, however the first-load size is extremely large. In this bundle, a major chunk is ethers (which is from Moralis), and web3uikit.
They both together are using up over 2mb of space, which is massive. Currently, my first load size is 1.5 mb, and I’d like to get this down to under 100kb, and managing these two modules will really help.
I’m only using Contract
from ethers, however, I’m not sure how I can use ES6 to only import that since I’m getting ethers from moralis like so: const ethers = Moralis.web3library
.
This is my first load:
┌ ○ / (1046 ms) 181 kB 1.41 MB
├ /_app 0 B 1.11 MB
├ ○ /404 241 B 1.11 MB
├ ○ /address 928 B 1.23 MB
├ ○ /all (1027 ms) 873 B 1.23 MB
├ ○ /profile (1007 ms) 977 B 1.23 MB
└ ○ /search (1018 ms) 1.21 kB 1.23 MB
+ First Load JS shared by all 1.11 MB
├ chunks/framework-38f22d267257f62d.js 45.1 kB
├ chunks/main-ee7948920624cbdc.js 31.2 kB
├ chunks/pages/_app-68b8ab65909399e4.js 1.03 MB
├ chunks/webpack-abc281d17b22c4fa.js 2.21 kB
└ css/539945d44b9a9160.css 3.01 kB
This is my package.json:
"dependencies": {
"@chakra-ui/react": "^2.3.6",
"@emotion/react": "^11.10.4",
"@emotion/styled": "^11.10.4",
"@next/bundle-analyzer": "^13.0.2",
"dotenv": "^16.0.3",
"framer-motion": "^7.6.5",
"moralis-v1": "^1.11.0",
"next": "latest",
"react": "18.1.0",
"react-dom": "18.1.0",
"react-moralis": "^1.4.2",
"source-map-explorer": "^2.5.3",
"web3uikit": "^0.1.159"
},
"devDependencies": {
"@types/node": "17.0.35",
"@types/react": "18.0.9",
"@types/react-dom": "18.0.5",
"autoprefixer": "^10.4.7",
"file-loader": "^6.2.0",
"postcss": "^8.4.14",
"tailwindcss": "^3.1.2",
"typescript": "4.7.2",
"url-loader": "^4.1.1"
}
Do you have any idea how I can go about reducing this? Thanks!