cal.pub0.org/next.config.js

50 lines
1.4 KiB
JavaScript
Raw Normal View History

// https://www.npmjs.com/package/next-transpile-modules
// This makes our @calcom/prisma package from the monorepo to be transpiled and usable by API
const withTM = require("next-transpile-modules")([
"@calcom/app-store",
2022-06-14 21:13:59 +00:00
"@calcom/core",
2022-07-02 03:04:21 +00:00
"@calcom/dayjs",
2022-06-14 21:13:59 +00:00
"@calcom/emails",
"@calcom/embed-core",
"@calcom/embed-snippet",
2022-07-28 19:51:20 +00:00
"@calcom/features",
"@calcom/lib",
"@calcom/prisma",
2022-08-03 17:49:45 +00:00
"@calcom/trpc",
]);
2022-07-08 00:00:00 +00:00
const { withAxiom } = require("next-axiom");
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",
},
2022-10-19 18:26:12 +00:00
// Keeps backwards compatibility with old webhook URLs
{
source: "/api/hooks/:rest*",
destination: "/api/webhooks/:rest*",
},
2022-07-08 00:00:00 +00:00
],
fallback: [
// These rewrites are checked after both pages/public files
// and dynamic routes are checked
{
source: "/:path*",
destination: `/api/:path*`,
},
],
};
},
})
);