aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/docs/next.config.js
blob: d92dbc68074ef6fb46ace62dd6775e23a1600df6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
const { withSentryConfig } = require("@sentry/nextjs");
const withNextra = require("nextra")({
  theme: "nextra-theme-docs",
  themeConfig: "./theme.config.js",
  unstable_flexsearch: true,
  unstable_staticImage: true,
});

const sentryWebpackPluginOptions = {
  silent: true,
};

const OLD_TURBOREPO_ROUTES = [
  "/docs",
  "/docs/getting-started/create-new",
  "/docs/getting-started/existing-monorepo",
  "/docs/acknowledgements",
  "/docs/faq",
  "/docs/troubleshooting",
];

const nextConfig = withNextra({
  sentry: {
    autoInstrumentServerFunctions: false,
    hideSourceMaps: true,
  },
  reactStrictMode: true,
  experimental: {
    legacyBrowsers: false,
  },
  webpack: (config, { webpack }) => {
    config.plugins.push(
      new webpack.DefinePlugin({
        __SENTRY_DEBUG__: false,
        __SENTRY_TRACING__: false,
      })
    );

    // return the modified config
    return config;
  },
  rewrites() {
    return {
      beforeFiles: [
        {
          source: "/sitemap.xml",
          destination:
            "https://crawled-sitemap.vercel.sh/turbobuild-sitemap.xml",
        },
      ],
    };
  },
  async redirects() {
    return [
      ...OLD_TURBOREPO_ROUTES.map((route) => ({
        source: route,
        destination: `/AI${route}`,
        permanent: true,
      })),
      {
        source: "/docs/getting-started",
        destination: "/AI/docs",
        permanent: true,
      },
      {
        source: "/discord{/}?",
        permanent: true,
        destination: "https://discord.gg/JBe8BYJgKT",
      },
      {
        source: "/docs/changelog",
        permanent: true,
        destination: "https://github.com/retrofor/HydroRoll/releases",
      },
      {
        // Accidentally created, eventually removable. See below.
        source: "/AI/docs/getting-started",
        destination: "/AI/docs",
        permanent: true,
      },
      {
        // This rule accidentally created a bunch of URLs.
        //
        // They've _never_ resolved, so _eventually_ we should be able to remove the
        // redirects we added above to fix them.
        source: "/docs/:path*",
        permanent: true,
        destination: "/AI/docs/:path*",
      },
    ];
  },
});

module.exports = withSentryConfig(nextConfig, sentryWebpackPluginOptions);