badgen.net/next.config.js

95 wiersze
2.4 KiB
JavaScript

2022-12-31 06:29:41 +00:00
/** @type {import('next').NextConfig} */
const { withSentryConfig } = require('@sentry/nextjs')
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,
},
sentry: {
// Use `hidden-source-map` rather than `source-map` as the Webpack `devtool`
// for client-side builds. (This will be the default starting in
// `@sentry/nextjs` version 8.0.0.) See
// https://webpack.js.org/configuration/devtool/ and
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#use-hidden-source-map
// for more information.
hideSourceMaps: true,
},
async rewrites() {
const badgeApis = [
'/static',
2023-03-18 02:53:04 +00:00
'/github',
2023-07-25 15:24:30 +00:00
'/gitlab',
2023-07-26 12:17:48 +00:00
'/https',
'/memo',
2023-07-02 11:57:22 +00:00
// registry
2023-07-02 00:01:52 +00:00
'/amo',
2023-06-10 01:25:28 +00:00
'/npm',
2023-06-28 08:40:09 +00:00
'/crates',
2023-07-02 11:57:22 +00:00
'/winget',
2023-07-28 14:35:25 +00:00
'/docker',
2023-07-28 14:42:07 +00:00
'/open-vsx',
'/chrome-web-store',
2023-07-02 00:15:06 +00:00
'/vs-marketplace',
'/hackage',
'/ppm',
2023-07-28 15:58:26 +00:00
'/pub',
2023-06-10 02:37:06 +00:00
'/pypi',
2023-07-02 11:57:22 +00:00
// analysis
'/bundlephobia',
'/packagephobia',
'/codeclimate',
'/codecov',
2023-08-01 14:22:56 +00:00
'/coveralls',
2023-07-02 11:57:22 +00:00
'/travis',
2023-08-08 15:57:11 +00:00
'/circleci',
'/xo',
2023-07-02 11:57:22 +00:00
// social network
'/discord',
'/matrix',
'/runkit',
2023-07-09 09:52:24 +00:00
'/peertube',
2023-06-10 07:27:32 +00:00
// discontinued
'/apm',
2023-06-19 07:51:39 +00:00
'/lgtm',
2023-06-22 06:57:25 +00:00
'/david',
]
let badgeRedirects = [
{ source: '/badge/:path*', destination: '/api/static' },
{ source: '/badge', destination: '/api/static' },
]
badgeRedirects = badgeRedirects
.concat(badgeApis.map(badge => ({ source: `${badge}/:path*`, destination: `/api${badge}` }))) // badges
.concat(badgeApis.map(badge => ({ source: badge, destination: `/api${badge}` }))) // doc pages
return badgeRedirects
},
2019-05-26 04:41:21 +00:00
}
2022-12-31 06:29:41 +00:00
const sentryWebpackPluginOptions = {
// Additional config options for the Sentry Webpack plugin. Keep in mind that
// the following options are set automatically, and overriding them is not
// recommended:
// release, url, org, project, authToken, configFile, stripPrefix,
// urlPrefix, include, ignore
silent: true, // Suppresses all logs
dryRun: process.env.VERCEL_ENV !== "production"
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options.
}
module.exports = withSentryConfig(nextConfig, sentryWebpackPluginOptions)