Files
react.dev/beta/next.config.js
Strek 2979d0c967 Splitting sandpack from main bundle (#4256)
* Initial Commit

* play with it

* oops

* easier repro

* import type

* remove `suspense: true`

* Add patch for next

* Patch package

* Add fallback

* Enable flag

* Fixes local dev env and adds better fallback for codeblock

* Adds fallback for sandpack (should work fine)

* turn off concurrentFeatures

* Revert "turn off concurrentFeatures"

This reverts commit 50158ecbd33969e707a2a91a54e822e90c2ebfde.

* Update SandpackWrapper.tsx

* Removed flags and setTimeouts

* add timeouts and promise again

* Adds bottom bezel and scroll to sandpack fallback

* tinker bottombezel and remove console

* Update CodeBlock.tsx

* Update SandpackWrapper.tsx

* removing overflows to avoid explicit scrolls

* upgrade nextjs to canary

* Rm patch

* Fix TS

* Bump Next

* No more CSS jumping

* Reverts the canary to use the latest Next.js `12.0.10`

Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
Co-authored-by: Dan Abramov <dan.abramov@me.com>
2022-02-16 23:06:04 +05:30

60 lines
1.5 KiB
JavaScript

/*
* 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;
},
};