-
Notifications
You must be signed in to change notification settings - Fork 15
/
next.config.js
executable file
·76 lines (72 loc) · 1.7 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
const childProcess = require('child_process');
const nextLog = require('next/dist/build/output/log');
const { EnvironmentPlugin } = require('webpack');
const getBuildId = () => {
// Prefer BUILD_ID env var if available
if (process.env.BUILD_ID !== undefined) return process.env.BUILD_ID;
// Attempt to get current git sha
try {
return childProcess.execSync('git rev-parse HEAD').toString().trim();
} catch (_) {
// Ignore any error
}
// Default to Next's own generation
return null;
};
/** @type {import('next').NextConfig} */
module.exports = {
output: 'export',
compiler: {
styledComponents: {
displayName: true,
ssr: true,
fileName: true,
cssProp: true,
minify: true,
transpileTemplateLiterals: true,
},
},
generateBuildId() {
const proposedBuildId = getBuildId();
nextLog.info(
`Using build ID: ${
proposedBuildId === null ? 'auto-generated' : `'${proposedBuildId}'`
}`,
);
return proposedBuildId;
},
webpack(config) {
config.plugins.push(
new EnvironmentPlugin({
BASE_URL: '',
API_BASE_URL: '',
API_EVENT_ID: '',
REGISTRATION_START: '',
REGISTRATION_END: '',
TRACKING_START: '',
PROFILE_END: '',
}),
);
config.module.rules.push({
test: /\.(eot|woff2?|zip|pdf)/,
type: 'asset/resource',
});
return config;
},
rewrites() {
return [
{
source: '/profile/edit',
destination: '/profile',
},
];
},
exportPathMap(defaultPathMap) {
return {
...defaultPathMap,
'/profile/edit': { page: '/profile' },
};
},
reactStrictMode: true,
trailingSlash: true,
};