-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
114 lines (109 loc) · 3.55 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('path');
// eslint-disable-next-line import/no-extraneous-dependencies
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
});
const { withContentlayer } = require('next-contentlayer');
const appHeaders = require('./headers');
const buildRedirect = (source, destination, permanent = true) => {
return {
source,
destination,
permanent,
};
};
/**
* @type {import('next').NextConfig}
*/
const defaultNextConfig = {
swcMinify: true,
reactStrictMode: true,
compress: true,
crossOrigin: 'anonymous',
experimental: {
newNextLinkBehavior: true,
legacyBrowsers: false,
optimizeCss: true,
},
compiler: {
removeConsole: {
exclude: ['error'],
},
},
sassOptions: {
includePaths: [path.join(__dirname, 'src/styles')],
},
images: {
remotePatterns: [
{ hostname: 'images.unsplash.com' },
{ hostname: 'i.scdn.co' },
{ hostname: 'spotify.com' },
{ hostname: 'jahir.dev' },
{ hostname: 'unavatar.io' },
{ hostname: 'source.boringavatars.com' },
{ hostname: 'lh3.googleusercontent.com' },
{ hostname: 'cdn.discordapp.com' },
{ hostname: 'raw.githubusercontent.com' },
{ hostname: 'avatars.githubusercontent.com' },
{ hostname: '**.cdninstagram.com' },
],
dangerouslyAllowSVG: true,
contentSecurityPolicy: "default-src 'self'; script-src 'none'; sandbox;",
},
webpack(config) {
config.module.rules.push({
test: /\.(woff|woff2|eot|ttf|otf)$/i,
issuer: { and: [/\.(js|ts)x?$/] },
type: 'asset/resource',
generator: {
filename: 'static/media/[name].[hash:8][ext]',
},
});
return config;
},
async headers() {
return appHeaders;
},
async redirects() {
return [
/* Blog posts redirections */
buildRedirect(
'/blog/a-priori-care',
'https://medium.com/@jahirfiquitiva/taking-a-priori-care-of-your-future-job-7ed24cf18ed2',
),
buildRedirect(
'/blog/md-iconography-guidelines',
'https://stories.uplabs.com/what-google-missed-in-their-guidelines-for-material-design-iconography-daf9f88000ec',
),
buildRedirect('/blog/post-of-fame', '/donate#thanks'),
/* Old static assets paths to news */
buildRedirect('/assets/:path*', '/static/:path*'),
/* Needed for android dashboards */
buildRedirect(
'/static/images/me/me.jpg',
'/static/images/jahir/jahir.jpg',
),
/* Dashbud links */
buildRedirect('/dashbud', 'https://dashbud.dev'),
buildRedirect('/dashbud/:path*', 'https://dashbud.dev'),
buildRedirect('/dashsetup', 'https://dashbud.dev'),
buildRedirect('/dashsetup/:path*', 'https://dashbud.dev'),
/* Other redirections */
buildRedirect('/links', '/'),
buildRedirect('/music', '/dashboard'),
buildRedirect('/now', '/dashboard'),
buildRedirect('/support', '/donate'),
buildRedirect('/sponsor', '/donate'),
buildRedirect('/thanks', '/donate#thanks'),
buildRedirect('/sponsors', '/donate#thanks'),
buildRedirect('/supporters', '/donate#thanks'),
buildRedirect('/blog/uses', '/uses'),
buildRedirect('/releases', '/gh-releases'),
buildRedirect('/feed', '/feed.xml'),
buildRedirect('/resume', '/share/Jahir-Fiquitiva-Resume.pdf'),
buildRedirect('/shop', 'https://www.shop.jahir.dev/nuestros-productos'),
];
},
};
module.exports = withBundleAnalyzer(withContentlayer(defaultNextConfig));