HackerTrans
热门最新趋势评论往期问答秀出招聘

cersa8

no profile record

评论

cersa8
·4年前·讨论
I had a similar realization that setting up a monorepo with lerna or workspaces was going to be challenging. For a Next.js + custom TypeScript / Node.js backend I decided to just add the backend in its own folder with a child tsconfig.json. This way you can have the backend compile to its own dist folder. No need to fiddle with the complex under the hood bundling that's going on in Next.js. It gives you a single git repo and backend and frontend share the same typings. To make things easier you can setup paths in tsconfig.json and use module-alias in package.json for things like

  import {IUser} from '@shared/interfaces/users/IUser'