-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
56 lines (53 loc) · 1.82 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
const { PHASE_DEVELOPMENT_SERVER, PHASE_PRODUCTION_BUILD } = require('next/constants');
const removeImports = require('next-remove-imports')();
module.exports = (phase) => {
// when started in development mode `next dev` or `npm run dev` regardless of the value of STAGING environmental variable
const isDev = phase === PHASE_DEVELOPMENT_SERVER;
// when `next build` or `npm run build` is used
const isProd = phase === PHASE_PRODUCTION_BUILD && process.env.STAGING !== '1';
// when `next build` or `npm run build` is used
const isStaging = phase === PHASE_PRODUCTION_BUILD && process.env.STAGING === '1';
console.log(`isDev:${isDev} isProd:${isProd} isStaging:${isStaging}`);
const env = {
SITE_NAME: 'De4th Zone',
WEBSITE_URL: (() => {
if (isDev) return 'http://localhost:999';
if (isProd) {
return 'https://frontend-blog-example.vercel.app';
}
if (isStaging) return 'https://frontend-blog-example.vercel.app';
return 'RESTURL_SPEAKERS:not (isDev,isProd && !isStaging,isProd && isStaging)';
})(),
API_URL: (() => {
if (isDev) return 'http://localhost:666/api';
if (isProd) return 'https://backend-blog-example.herokuapp.com/api';
if (isStaging) return 'https://backend-blog-example.herokuapp.com/api';
return 'RESTURL_SESSIONS:not (isDev,isProd && !isStaging,isProd && isStaging)';
})(),
LIMIT_PAGE: {
ARTICLES: 10,
ARTICLES_RELATED: 6
},
REQUEST: {
TIMEOUT: 30000
},
LOGO_URL: '/images/6666666666.png'
};
return removeImports({
env,
reactStrictMode: true,
images: {
domains: [
'localhost',
'backend-blog-example.herokuapp.com',
'elasticbeanstalk-ap-southeast-1-153036539674.s3.ap-southeast-1.amazonaws.com',
'de4thzone.s3.ap-southeast-1.amazonaws.com'
]
},
i18n: {
locales: ['en', 'vi'],
defaultLocale: 'en',
localeDetection: false
}
});
};