Files
react.dev/next.config.js
Jimmy Lai 0eb0f889b1 feat: migrate React.dev to the App Router (#7437)
* update version to latest + move folders around

* getting home page working

* make the mdx setup work

* bypass mdxname

* split out mdx components

* re-add meta mdx logic

* replace mdxName usage

* fix code blocks

* fix max width

* convert mdx post processing to actual plugins

* fix tailwind

* fix incorrect iframe props

* cleanup mdx dic

* make it actually build

* align fonts

* fix uwu script

* fix search

* remove _app

* make it actually build

* replace next-watch-remote with custom setup

* clean up logs + clean up inline scripts

* add rss handler

* remove rss generation

* remove rss generation

* support MDX components for TOC

* clean up log + bump cache

* fix toc

* add back translations + add new overlay

* use MDX link instead of Next.js links for translation

* fix analytics

* add myself to the contributors

* fix blinking sidebar

* avoid rendering toc on the client

* plugin metadata

* simplify metadata

* fix title

* clean up metadata

* add back error decoder

* Update src/content/learn/index.md

---------

Co-authored-by: Ricky <rickhanlonii@gmail.com>
2025-02-01 11:35:16 -05:00

66 lines
1.7 KiB
JavaScript

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*/
/**
* @type {import('next').NextConfig}
**/
const nextConfig = {
pageExtensions: ['jsx', 'js', 'ts', 'tsx', 'mdx', 'md'],
reactStrictMode: true,
experimental: {
scrollRestoration: true,
reactCompiler: true,
newDevOverlay: true,
},
env: {},
serverExternalPackages: [],
webpack: (config, {dev, isServer, ...options}) => {
if (process.env.ANALYZE) {
const {BundleAnalyzerPlugin} = require('webpack-bundle-analyzer');
config.plugins.push(
new BundleAnalyzerPlugin({
analyzerMode: 'static',
reportFilename: options.isServer
? '../analyze/server.html'
: './analyze/client.html',
})
);
}
// Don't bundle the shim unnecessarily.
config.resolve.alias['use-sync-external-store/shim'] = 'react';
const {IgnorePlugin, NormalModuleReplacementPlugin} = require('webpack');
config.plugins.push(
new NormalModuleReplacementPlugin(
/^raf$/,
require.resolve('./src/utils/rafShim.js')
),
new NormalModuleReplacementPlugin(
/^process$/,
require.resolve('./src/utils/processShim.js')
),
new IgnorePlugin({
checkResource(resource, context) {
if (
/\/eslint\/lib\/rules$/.test(context) &&
/\.\/[\w-]+(\.js)?$/.test(resource)
) {
// Skips imports of built-in rules that ESLint
// tries to carry into the bundle by default.
// We only want the engine and the React rules.
return true;
}
return false;
},
})
);
return config;
},
};
module.exports = nextConfig;