Reputation: 3489
Created a website using next.js with both backend and frontend in one project.In production it takes so much of time to load a webpage.Next version is 9.3.0. this is my script.using of scss effects loading time
package.json
"scripts": {
"dev": "ts-node --compiler-options=\"{\\\"module\\\": \\\"commonjs\\\"}\" server/server.ts",
"build": "next build",
"start": "NODE_ENV=production 'ts-node' --compiler-options=\"{\\\"module\\\": \\\"commonjs\\\"}\" server/server.ts"
}
Upvotes: 0
Views: 7975
Reputation: 8546
For those curious, this was caused by Windows Defender. Windows Defender was delaying the HMR (to do a scan) because our emitted JavaScript files contained the word eval! That's why macOS was unaffected.
Upvotes: 1
Reputation: 35553
I guess that you are starting your production app using npm run start
.
From it, it looks like you are running ts-node
on production (which compiles TS on the fly).
It is better to compile server.ts
on build
step using typescript into dist
or something like this, then run node on a js result inside dist
folder.
Upvotes: 2