Does Next.js always compile this long? At times it can even take 40 seconds.
Unanswered
filyys posted this in #help-forum
filyysOP
11 Replies
Russian Spaniel
must be a package that is creating this issue. try to pair down as many packages in package.json as you can do can and then add them one by one and see what the time to compile is.
filyysOP
Pair down as many packages? What do you mean by this?
Russian Spaniel
your package.json. reset it back to the default packages.
filyysOP
Okay, by the way these are my current dependencies
"dependencies": {
"better-sqlite3": "^11.1.2",
"drizzle-orm": "^0.31.4",
"next": "14.2.4",
"react": "^18",
"react-dom": "^18"
},
"devDependencies": {
"@types/bun": "^1.1.6",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"drizzle-kit": "^0.22.8",
"eslint": "^8",
"eslint-config-next": "14.2.4",
"postcss": "^8",
"tailwindcss": "^3.4.1",
"typescript": "^5"
}@filyys Click to see attachment
Turkish Van
In case You think there is a package that is creating this issue, as Pual stated above, You can try using the
optimizePackageImports feature inside of the next.config.js options.filyysOP
Okay, I'll try that
@Turkish Van In case You think there is a package that is creating this issue, as Pual stated above, You can try using the `optimizePackageImports` feature inside of the `next.config.js` options.
filyysOP
Which packages should I put in the
optimizePackageImports? All of them? Or as Paul said, one by one to find the one causing it and then put that one inside?@filyys Which packages should I put in the `optimizePackageImports`? All of them? Or as Paul said, one by one to find the one causing it and then put that one inside?
Turkish Van
Some of the packages are optimized by default.
Take a look here: https://nextjs.org/docs/app/api-reference/next-config-js/optimizePackageImports
Find out which of those are not optimized by default and try either adding them all, or adding them one by one in case You really want to find out which one of them is causing the issue.
Take a look here: https://nextjs.org/docs/app/api-reference/next-config-js/optimizePackageImports
Find out which of those are not optimized by default and try either adding them all, or adding them one by one in case You really want to find out which one of them is causing the issue.
Russian Spaniel
tailwind, postcss, drizzle, sqlite3 are the ones you have added to the default install of nextjs
I could be wrong, but I don't think optimizing will help. As these are common packages and everyone would be having issues
filyysOP
Alright thanks y'all for the support, I really appreciate it