You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.5 KiB
59 lines
1.5 KiB
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*/
|
|
|
|
const path = require('path');
|
|
const {remarkPlugins} = require('./plugins/markdownToHtml');
|
|
const redirects = require('./src/redirects.json');
|
|
|
|
module.exports = {
|
|
pageExtensions: ['jsx', 'js', 'ts', 'tsx', 'mdx', 'md'],
|
|
experimental: {
|
|
plugins: true,
|
|
// TODO: this doesn't work because https://github.com/vercel/next.js/issues/30714
|
|
concurrentFeatures: false,
|
|
scrollRestoration: true,
|
|
},
|
|
async redirects() {
|
|
return redirects.redirects;
|
|
},
|
|
rewrites() {
|
|
return [
|
|
{
|
|
source: '/feed.xml',
|
|
destination: '/_next/static/feed.xml',
|
|
},
|
|
];
|
|
},
|
|
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',
|
|
})
|
|
);
|
|
}
|
|
|
|
// Add our custom markdown loader in order to support frontmatter
|
|
// and layout
|
|
config.module.rules.push({
|
|
test: /.mdx?$/, // load both .md and .mdx files
|
|
use: [
|
|
options.defaultLoaders.babel,
|
|
{
|
|
loader: '@mdx-js/loader',
|
|
options: {
|
|
remarkPlugins,
|
|
},
|
|
},
|
|
path.join(__dirname, './plugins/md-layout-loader'),
|
|
],
|
|
});
|
|
|
|
return config;
|
|
},
|
|
};
|
|
|