Skip to content

Instantly share code, notes, and snippets.

@endymion1818
Created August 6, 2021 13:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save endymion1818/af00a048b7b5211c311699b3326ca230 to your computer and use it in GitHub Desktop.
Save endymion1818/af00a048b7b5211c311699b3326ca230 to your computer and use it in GitHub Desktop.
NextJS withPlugins redirects
const withPlugins = require('next-compose-plugins');
const withSourceMaps = require('@zeit/next-source-maps');
const nextConfig = {
basePath: '/messages',
};
const _withSourceMaps = [
withSourceMaps,
{
webpack: (config, options) => config,
},
];
const redirects = {
async redirects() {
return [
{
source: '/',
destination: `/some/destination`,
permanent: false
},
{
source: '/:path*',
destination: `/some/destination/:path*`,
permanent: false
}
]
}
}
module.exports = withPlugins([_withSourceMaps, nextConfig, [redirects]]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment