oxen-website/next.config.js

65 lines
1.6 KiB
JavaScript
Raw Normal View History

2021-01-31 11:02:19 +01:00
/* eslint-disable @typescript-eslint/no-var-requires */
2021-01-22 03:43:42 +01:00
const withPlugins = require('next-compose-plugins');
const withFonts = require('next-fonts');
const withSvgr = require('next-svgr');
const nextConfig = {
webpack(config) {
const rules = [{}];
return {
...config,
module: {
...config.module,
rules: [...config.module.rules, ...rules],
},
node: {
fs: 'empty',
},
};
},
env: {
2021-01-31 11:02:19 +01:00
CONTENTFUL_SPACE_ID: process.env.CONTENTFUL_SPACE_ID,
CONTENTFUL_ACCESS_TOKEN: process.env.CONTENTFUL_ACCESS_TOKEN,
2021-01-22 03:43:42 +01:00
},
images: {
2021-09-02 14:42:15 +02:00
domains: ['downloads.ctfassets.net', 'images.ctfassets.net'],
},
2021-09-19 06:10:39 +02:00
serverRuntimeConfig: {
redirects: [
2021-05-17 06:36:27 +02:00
{
source: '/blog/session-the-road-to-monetisation-and-oxen-value-capture',
destination: '/blog/session-the-road-to-monetisation',
permanent: true,
},
2021-09-19 06:10:39 +02:00
],
},
async redirects() {
return this.serverRuntimeConfig.redirects;
2021-05-17 06:36:27 +02:00
},
2021-09-03 16:10:01 +02:00
async rewrites() {
return [
{
source: '/feed',
destination: '/api/feed/rss',
},
{
source: '/feed/:slug',
destination: '/api/feed/:slug',
},
// Redirects blog posts i.e. https://oxen.io/blog/hello or https://oxen.io/blog/hello-world
// Ignores page results i.e. https://oxen.io/blog/1
{
source: '/blog/:slug((?:[\\w]{1,}[\\-]{1,}).*|[\\D]{1,})',
destination: '/:slug',
},
2021-09-19 06:10:39 +02:00
{
source: '/sitemap.xml',
destination: '/api/sitemap',
},
2021-09-03 16:10:01 +02:00
];
},
2021-01-22 03:43:42 +01:00
};
2021-02-18 05:44:53 +01:00
module.exports = withPlugins([withFonts, withSvgr], nextConfig);