-
Notifications
You must be signed in to change notification settings - Fork 153
Expand file tree
/
Copy pathnext.config.js
More file actions
53 lines (47 loc) · 1.27 KB
/
next.config.js
File metadata and controls
53 lines (47 loc) · 1.27 KB
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
// const path = require('path');
// const process = require('process');
// const CopyWebpackPlugin = require('copy-webpack-plugin');
import path from 'path';
import process from 'process';
import { execSync } from 'child_process';
const pathBuilder = (subpath) => path.join(process.cwd(), subpath);
// Get commit hash and build time
const getCommitHash = () => {
try {
return execSync('git rev-parse --short HEAD').toString().trim();
} catch (error) {
return 'unknown';
}
};
const getBuildTime = () => {
return new Date().toISOString();
};
const __dirname = path.resolve();
/** @type {import('next').NextConfig} */
const nextConfig = {
basePath: process.env.NEXT_PUBLIC_BASE_PATH || undefined,
env: {
NEXT_PUBLIC_COMMIT_HASH: getCommitHash(),
NEXT_PUBLIC_BUILD_TIME: getBuildTime(),
},
webpack: (config, { webpack }) => {
return config
},
sassOptions: {
includePaths: [path.join(__dirname, 'styles')],
},
images: {
unoptimized: true,
},
output: 'export',
async rewrites() {
return [
{
source: '/map/:slug',
destination: '/map?s=:slug',
},
];
},
};
// module.exports = nextConfig;
export default nextConfig;