This repository was archived by the owner on Sep 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
73 lines (72 loc) · 2.73 KB
/
Copy pathnext.config.js
File metadata and controls
73 lines (72 loc) · 2.73 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
const withPlugins = require('next-compose-plugins');
const withBundleAnalyzer = require('@next/bundle-analyzer');
const { i18n } = require('./next-i18next.config');
module.exports = withPlugins([withBundleAnalyzer({ enabled: process.env.ANALYZE === 'true' })], {
webpack: (config, { dev, webpack }) => ({
...config,
plugins: [...(config?.plugins || []), new webpack.DefinePlugin({ PRODUCTION_MODE: JSON.stringify(!dev) })],
module: {
...(config?.module || {}),
rules: [
...(config?.module?.rules || []),
{
test: /\.svg$/,
issuer: /\.(js|ts)x?$/,
loader: require.resolve('react-svg-loader'),
options: { svgo: { plugins: [{ removeViewBox: false }] } },
},
{
test: /\.(png|jpe?g|webp|gif|)$/i,
use: [
{
loader: 'img-optimize-loader',
options: {
esModule: true,
compress: {
mode: 'low',
webp: true,
disableOnDevelopment: true,
svgo: true,
gifsicle: { optimizationLevel: 3 },
},
name: '[name]_[hash].[ext]',
publicPath: '/_next/static/files',
outputPath: 'static/files',
inline: { symbol: '__inline' },
},
},
],
},
{
test: /\.(ico|mp4|mkv|webm)$/,
loader: 'file-loader',
options: {
name: '[name]_[hash].[ext]',
publicPath: '/_next/static/files',
outputPath: 'static/files',
},
},
],
},
}),
i18n,
async redirects() {
return [
{
source: '/review',
destination: 'https://github.com/rigami/readme/blob/main/REVIEW.md',
permanent: true,
},
{
source: '/bug-report',
destination: 'https://github.com/rigami/readme/blob/main/BUG_REPORT.md',
permanent: true,
},
{
source: '/migrate-from-clock-tab',
destination: '/',
permanent: true,
},
];
},
});