This repository has been archived by the owner on Jul 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
55 lines (50 loc) · 1.6 KB
/
next.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* eslint-disable @typescript-eslint/no-var-requires */
const withMDX = require('@next/mdx')();
const ANALYZE = Boolean(process.env.ANALYZE);
const BACKEND_URL = process.env.BACKEND_URL || 'https://test.boluo.chat';
module.exports = withMDX(
/** @type {import('next').NextConfig} */
{
reactStrictMode: true,
poweredByHeader: false,
trailingSlash: true,
swcMinify: false,
i18n: {
locales: ['en', 'ja', 'zh-CN'],
defaultLocale: 'en',
},
eslint: {
dirs: ['src', 'tests'],
},
output: 'standalone',
async rewrites() {
return [
{
source: '/api/:path*',
destination: `${BACKEND_URL}/api/:path*`, // Proxy to Backend
},
];
},
webpack: (config) => {
if (ANALYZE) {
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const plugin = new BundleAnalyzerPlugin({
analyzerMode: 'static',
});
config.plugins.push(plugin);
}
// noinspection JSValidateTypes
config.module.rules.push({
test: /\.svg$/,
use: ['@svgr/webpack'],
});
// `react-intl` without parser
// https://formatjs.io/docs/guides/advanced-usage#react-intl-without-parser-40-smaller
// https://github.com/vercel/next.js/issues/30434
config.resolve.alias['@formatjs/icu-messageformat-parser'] = '@formatjs/icu-messageformat-parser/no-parser';
// avoid extra bundle cost, see https://github.com/reduxjs/react-redux/releases/tag/v8.0.0
config.resolve.alias['react-redux'] = 'react-redux/es/next';
return config;
},
}
);