-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
next.config.js
69 lines (67 loc) · 1.75 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
const { withFaust, getWpHostname } = require( '@faustwp/core' ); // eslint-disable-line @typescript-eslint/no-var-requires
const withBundleAnalyzer = require( '@next/bundle-analyzer' )( { // eslint-disable-line @typescript-eslint/no-var-requires
enabled: process.env.ANALYZE === 'true',
} );
const withPWA = require( 'next-pwa' )( { // eslint-disable-line @typescript-eslint/no-var-requires
dest: 'public',
register: true,
skipWaiting: true,
buildExcludes: [ /middleware-manifest.json$/ ],
disable: process.env.NODE_ENV === 'development',
} );
const faustConfig = withBundleAnalyzer(
withPWA( {
typescript: {
// !! WARN !!
// Dangerously allow production builds to successfully complete even if
// your project has type errors.
// !! WARN !!
ignoreBuildErrors: true,
},
swcMinify: true,
trailingSlash: true,
reactStrictMode: true,
compress: true,
productionBrowserSourceMaps: true,
experimental: {
swcFileReading: true,
},
pageExtensions: [ 'ts', 'tsx', 'js', 'jsx' ],
images: {
domains: [ getWpHostname(), process.env.NEXT_PUBLIC_WORDPRESS_URL ],
minimumCacheTTL: 31536000,
},
sassOptions: {
includePaths: [ 'node_modules', './src' ],
},
webpack( config ) {
config.module.rules.push( {
test: /\.svg$/i,
issuer: /\.[jt]sx?$/,
use: [ '@svgr/webpack' ],
} );
return config;
},
async redirects() {
return require( './redirects.json' );
},
rewrites: async () => [
{
source: '/rss.xml',
destination: '/api/feeds/rss.xml',
},
{
source: '/feed.atom',
destination: '/api/feeds/feed.atom',
},
{
source: '/feed.json',
destination: '/api/feeds/feed.json',
},
],
} ),
);
/**
* @type {import('next').NextConfig}
*/
module.exports = withFaust( faustConfig );