-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
79 lines (73 loc) · 1.91 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
const getBuildConfig = (...args) => {
const withPlugins = require('next-compose-plugins');
const withImages = require('next-images');
const withMDX = require('@next/mdx')({
extension: /\.mdx?$/,
options: {
remarkPlugins: [],
rehypePlugins: [],
},
});
const path = require('path');
const nextConfig = {
/* config options here */
env: {
HOST: 'tagion.org', // pass custom runtime env variables
},
// basePath: '/path', // base site path ex: 'example.com/path'
distDir: 'build',
pageExtensions: ['jsx', 'js', 'tsx', 'ts'],
// assetPrefix: isProd ? 'https://cdn.mydomain.com' : '', // CDN assets prefix
sassOptions: {
includePaths: [path.join(__dirname, '/lib/scss')],
},
images: {
static: true,
},
optimizedImages: true,
compress: true,
poweredByHeader: false,
generateEtags: true,
trailingSlash: true,
reactStrictMode: true,
devIndicators: {
buildActivityPosition: 'top-right',
buildActivity: true,
},
serverRuntimeConfig: {
// Will only be available on the server side
// mySecret: 'secret',
// secondSecret: process.env.SECOND_SECRET, // Pass through env variables
},
publicRuntimeConfig: {
// Will be available on both server and client
// staticFolder: '/public',
},
eslint: {
// Warning: This allows production builds to successfully complete even if
// your project has ESLint errors.
ignoreDuringBuilds: process.env.NODE_ENV === 'development',
},
webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {
config.module.rules.push({
test: /\.svg$/,
issuer: {
and: [/\.(js|ts)x?$/],
},
use: [
{
loader: '@svgr/webpack',
},
],
});
return config;
},
};
return withPlugins(
[[withImages, { fileExtensions: ['jpg', 'jpeg', 'png', 'gif'] }], [withMDX]],
nextConfig,
)(...args);
};
module.exports = (phase, ...rest) => {
return getBuildConfig(phase, ...rest);
};