2022-04-30 21:07:21 +00:00
|
|
|
// https://www.npmjs.com/package/next-transpile-modules
|
|
|
|
// This makes our @calcom/prisma package from the monorepo to be transpiled and usable by API
|
2022-04-13 16:53:44 +00:00
|
|
|
const withTM = require("next-transpile-modules")([
|
|
|
|
"@calcom/app-store",
|
2022-06-14 21:13:59 +00:00
|
|
|
"@calcom/core",
|
2022-04-13 16:53:44 +00:00
|
|
|
"@calcom/ee",
|
2022-06-14 21:13:59 +00:00
|
|
|
"@calcom/lib",
|
|
|
|
"@calcom/prisma",
|
|
|
|
"@calcom/stripe",
|
|
|
|
"@calcom/ui",
|
2022-07-02 03:04:21 +00:00
|
|
|
"@calcom/dayjs",
|
2022-06-14 21:13:59 +00:00
|
|
|
"@calcom/emails",
|
2022-07-08 15:58:18 +00:00
|
|
|
"@calcom/dayjs",
|
2022-06-14 21:13:59 +00:00
|
|
|
"@calcom/embed-core",
|
2022-07-05 18:12:14 +00:00
|
|
|
"@calcom/dayjs",
|
2022-06-14 21:13:59 +00:00
|
|
|
"@calcom/embed-snippet",
|
2022-04-13 16:53:44 +00:00
|
|
|
]);
|
2022-07-08 00:00:00 +00:00
|
|
|
const { withAxiom } = require("next-axiom");
|
2022-03-25 18:37:51 +00:00
|
|
|
|
2022-07-08 00:00:00 +00:00
|
|
|
module.exports = withAxiom(
|
|
|
|
withTM({
|
|
|
|
async rewrites() {
|
|
|
|
return {
|
|
|
|
afterFiles: [
|
|
|
|
// This redirects requests recieved at / the root to the /api/ folder.
|
|
|
|
{
|
|
|
|
source: "/v:version/:rest*",
|
|
|
|
destination: "/api/v:version/:rest*",
|
|
|
|
},
|
|
|
|
// This redirects requests to api/v*/ to /api/ passing version as a query parameter.
|
|
|
|
{
|
|
|
|
source: "/api/v:version/:rest*",
|
|
|
|
destination: "/api/:rest*?version=:version",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
fallback: [
|
|
|
|
// These rewrites are checked after both pages/public files
|
|
|
|
// and dynamic routes are checked
|
|
|
|
{
|
|
|
|
source: "/:path*",
|
|
|
|
destination: `/api/:path*`,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
},
|
|
|
|
})
|
|
|
|
);
|