worldguessr/next.config.js
joshii 558f03cb70
Some checks failed
CoolMath Games Build / build-coolmath (push) Failing after 1m31s
GameDistribution Build / build-gamedistribution (push) Failing after 13s
Initial commit
2026-03-15 13:37:08 +01:00

53 lines
No EOL
1.3 KiB
JavaScript

// 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;