From 599dccdcce8e6e578fdc9cca38766f5bab334d23 Mon Sep 17 00:00:00 2001 From: Agusti Fernandez Pardo Date: Fri, 8 Jul 2022 02:00:00 +0200 Subject: [PATCH] feat: add axiom --- next.config.js | 55 ++++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/next.config.js b/next.config.js index f8491c9904..8c5749db55 100644 --- a/next.config.js +++ b/next.config.js @@ -13,30 +13,33 @@ const withTM = require("next-transpile-modules")([ "@calcom/embed-core", "@calcom/embed-snippet", ]); +const { withAxiom } = require("next-axiom"); -module.exports = 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*`, - }, - ], - }; - }, -}); +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*`, + }, + ], + }; + }, + }) +);