Next.js on Plesk
Hi, I have been scratching my head around for a few days not understanding an error message from the plesk server I tend to host my app on.
I've tested this host in the past with a bare create-next-app it worked flawlessly, I tried the T3 stack because why not, worked god at home (win/debian) but on the production server ...
An then it hit me, it talked about beeing a "module", then I searched why and landed on this comment in the commit that led to it : "imo every project in 2023 should use
type: module
"
So the 2 questions are :
- Why should projects be "module" (I didn't quite get the difference between this and ... not)
- Should I expect projects build from the T3 template not to work for any reason because on flagging it as not a module ?
ThxSolution:Jump to solution
// entry.cjs
async function loadApp() {
const { app } = await import("./app.js"); // this is your normal entry file - (index.js, main.js, app.mjs etc.)
}
loadApp()...
3 Replies
Well ... scratched a little more and got it working (having an entry.cjs calling the ".next/standalone/server.js" did the job)
Solution
// entry.cjs
async function loadApp() {
const { app } = await import("./app.js"); // this is your normal entry file - (index.js, main.js, app.mjs etc.)
}
loadApp()
well ... not exactly the right import path, but that's the example I found to get me outta trouble
Nice talking to me 😅 see me next time