next.config.mjs 948 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { createMDX } from 'fumadocs-mdx/next';
  2. import redirectsJson from './redirects.json' with { type: 'json' };
  3. const withMDX = createMDX({
  4. mdxOptions: {
  5. lastModifiedTime: 'git',
  6. },
  7. });
  8. /** @type {import('next').NextConfig} */
  9. const config = {
  10. reactStrictMode: true,
  11. webpack: (config) => {
  12. // Existing config
  13. config.module.rules.push({
  14. test: /\.svg$/,
  15. use: [{ loader: '@svgr/webpack', options: { icon: true } }],
  16. });
  17. // Important: return the modified config
  18. return config;
  19. },
  20. async redirects() {
  21. return [
  22. // Redirect root to /docs, can remove if a landing page is added
  23. {
  24. source: '/',
  25. destination: '/docs',
  26. permanent: false,
  27. },
  28. // Redirect routes from old docs
  29. ...redirectsJson.redirects.map((redirect) => ({
  30. ...redirect,
  31. permanent: redirect.permanent ?? true,
  32. })),
  33. ];
  34. },
  35. };
  36. export default withMDX(config);