Next.JS + pkg for a single executable binary #13801
-
|
I've got a project that has both the api routes and frontend built with next, it does use SSR for a few pages and wanted to convert it to a single binary with pkg. I've seen posts around for the older version and they seem to work for those specific version but doesn't seem to work with the latest version on next.js Posting this here because PKG doesn't have the discussions section. What I tried
The IssueServer starts but then the main pages/index.js is not rendered but pages/login/index.js get's rendered if I change the url manually. Another thing is that
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Things Fixed
Hope that helps someone else who's on the same path and stuck at it. |
Beta Was this translation helpful? Give feedback.
-
|
@barelyhuman have you been using this approach since 2020? hows it going? |
Beta Was this translation helpful? Give feedback.
Things Fixed
Fixed the importing of html template problem by modifying the file to be a js file and exporting the HTML as a string , since I was unable to get the snapshot to import the folder for some reason
The reason the pages weren't being rendered was because the binary wasn't able to compile them and made all of these to be statically compiled by adding a dummy
getStaticPropsandgetStaticPathsas needed to the files.Hope that helps someone else who's on the same path and stuck at it.