Next.js Discord

Discord Forum

Dev server is building all markdown files

Unanswered
Bakharwal dog posted this in #help-forum
Open in Discord
Bakharwal dogOP
Hey all, I want to start my dev server as fast as possible, using nextjs 14 with app router.
I have more than a 1000 mdx files under content folder, which is not inside src/app.
I have a catch all dynamic route where i'm using a dynamic import to get the mdx file, using @next/mdx.
How can I stop the dev server from building the entire doc set? for no reason at all?

here is my config:
const withMDX = mdx({
  extension: /\.mdx?$/,
  options: {
    providerImportSource: '@mdx-js/react',
    remarkPlugins,
    rehypePlugins,
    recmaPlugins,
  },
});

/** @type {import('next').NextConfig} */
const nextConfig = {
  swcMinify: true,
  pageExtensions: ['ts', 'tsx', 'mdx'],
  images: {
    remotePatterns: [
      {
        protocol: 'https',
        hostname: 'files.readme.io',
      },
    ],
  },
  transpilePackages: ['geist'],
  experimental: {
    scrollRestoration: true,
    swcPlugins: [['@lingui/swc-plugin', {}]],
    outputFileTracingIncludes: {
      '/': ['./content/**/*', './i18n/**/*'],
    },
  },
  async redirects() {
    const redirects = await fs.readFile(
      require.resolve('./redirects.json'),
      'utf8'
    );
    return JSON.parse(redirects);
  },
  webpack(config) {
    config.module.rules.push({
      test: /\.po$/,
      use: {
        loader: '@lingui/loader',
      },
    });
    return config;
  },
};

0 Replies