badgen.net/next.config.js

43 wiersze
1.0 KiB
JavaScript
Czysty Zwykły widok Historia

2022-12-31 06:29:41 +00:00
/** @type {import('next').NextConfig} */
const badgeList = require('./public/.meta/badges.json')
2022-12-31 06:29:41 +00:00
const nextConfig = {
reactStrictMode: true,
2023-01-04 01:31:10 +00:00
optimizeFonts: false,
2022-12-31 06:29:41 +00:00
experimental: {
2023-01-04 01:31:10 +00:00
appDir: false,
2022-12-31 06:29:41 +00:00
forceSwcTransforms: true,
},
async rewrites() {
const liveBadgeRedirects = badgeList.live.map(badge => {
return {
source: `/${badge.id}/:path*`,
destination: `/api/${badge.id}/:path*`,
}
})
const staticBadgeRedirects = [{
source: `/badge/:path*`,
destination: `/api/badge/:path*`,
}]
const badgeRedirects = liveBadgeRedirects.concat(staticBadgeRedirects)
// return badgeRedirects
return [
{ source: '/static/:path*', destination: '/api/static' },
{ source: '/static', destination: '/api/static' },
{ source: '/badge/:path*', destination: '/api/static' },
2023-02-05 11:20:03 +00:00
{ source: '/badge', destination: '/api/static' },
{ source: '/xo/:path*', destination: '/api/xo' },
{ source: '/xo', destination: '/api/xo' },
]
},
2019-05-26 04:41:21 +00:00
}
2022-12-31 06:29:41 +00:00
module.exports = nextConfig