使用 Next JS 和 Turborepo 创建通用共享页面

Vip*_*jan 6 routes monorepo next.js turborepo

我有一个monorepo用turborepo 创建的,其中包含两个next.js应用程序。结构如下

base
|---apps
|   |---editor
|   |    |---pages
|   |        |---index.js //this file is different in both apps
|   |        |---anotherPage.js //this is the same file in both apps
|   |   
|   |---etsy
|        |---pages
|            |---index.js //this file is different in both apps
|            |---anotherPage.js //this is the same file in both apps
|
|---package
Run Code Online (Sandbox Code Playgroud)

在Next JS中,有自动路由。所以当我转到 时url/otherPage,它会自动重定向到该otherPage.js页面。我在应用程序之间有很多通用页面。目录里还有一堆常用的API pages/api。如何制作一个系统,将这些共享页面保存在packages目录下,同时仍然保留自动路由和 api 路由。