-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
85 lines (73 loc) · 1.9 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
const withPWA = require('next-pwa');
const { PHASE_PRODUCTION_BUILD } = require('next/constants');
const bundleAnalyzer = require('@next/bundle-analyzer')({
enabled: !!process.env.BUNDLE_ANALYZE,
});
const config = require('./config.json');
module.exports = (phase) => {
const isProd = phase === PHASE_PRODUCTION_BUILD;
const nodeEnv = (() => {
if (isProd) return 'production';
return 'development';
})();
console.log('🚀🚀 ENV: ', nodeEnv);
const env = {
PRODUCTION_VERSION: config.PRODUCTION_VERSION,
SERVER_URI: config.SERVER_URI,
WEB_URI: config.WEB_URI,
SECRET: config.SECRET,
NEXTAUTH_URL: config.NEXTAUTH_URL,
};
console.log('env_log', env);
const configWithPwa = withPWA({
dest: 'public',
register: true,
skipWaiting: true,
disable: process.env.NODE_ENV === 'development',
}); // other config options});
// next.config.js object
const analyzer = bundleAnalyzer({
env,
sassOptions: {
// includePaths: ['./styles'],
prependData: `@import "./public/styles/base.scss";`,
},
images: {
remotePatterns: [
{
protocol: 'https',
hostname: '**',
},
],
},
experimental: {
// outputStandalone: true,
// appDocumentPreloading: true,
// adjustFontFallbacks: true,
},
output: 'standalone',
eslint: {
// Warning: This allows production builds to successfully complete even if
// your project has ESLint errors.
ignoreDuringBuilds: true,
},
i18n: {
locales: ['default', 'en', 'ar'],
defaultLocale: 'default',
localeDetection: false,
},
trailingSlash: true,
webpack(config) {
config.module.rules.push({
test: /\.svg$/i,
issuer: /\.[jt]sx?$/,
use: ['@svgr/webpack'],
});
return config;
},
});
return {
// ...configWithPwa,
...analyzer,
};
};